this project is a homework in the paralell processing course.
---
# Multi-Threaded Java HTTP Server
# Multi-Threaded Java web Server
This project contain two types of multi-threaded web servers, both equipped with thread-pooling capabilities, designed to efficiently execute a variety of simple tasks.
...
...
@@ -13,21 +13,60 @@ This project contain two types of multi-threaded web servers, both equipped with
-**TaskExecutor**: Executes the specified task by dynamically instantiating it and processing the input.
## How to Run
## Usage
### Running the Server Locally
1.**Start the Server**: Compile and run the main server file to start listening for HTTP requests.
2.**Make Requests**:
-**GET Request**: Retrieves a list of completed tasks.
-**POST Request**: Sends a task request with parameters. Example using `curl`:
1.**Clone the repository**:
```bash
curl -X POST http://localhost:8000/ -d"TaskSimulateDownload&5000"
- Replace `TaskSimulateDownload&5000` with the desired task and input.
2. **Compile and Run the Project**:
- Use your preferred Java IDE or run from the terminal:
```bash
javac -d bin -sourcepath src src/main/WebServerHttp.java
java -cp bin main.WebServerHttp
```
- The server will start on port `8000`.
### Running with Docker
1. **Build the Docker Image**:
```bash
docker build -t task-manager-server .
```
2. **Run the Docker Container**:
```bash
docker run -p 8000:8000 task-manager-server
```
The server will now be available on `localhost:8000`.
## Sending Requests
You can use `curl` to send requests to the server. The server supports `POST` requests for executing tasks and `GET` requests to view the list of completed tasks.
### Example Requests
- **Geometric Mean Task**:
```bash
curl -X POST http://localhost:8000 -d"TaskGeometricMean&1,2,3,4,5"
```
- **Bubble Sort Task**:
```bash
curl -X POST http://localhost:8000 -d"TaskBubbleSort&5,3,8,1,2"
```
## the new Tasks
- **TaskGeometricalMean**: Calculate the Geometrical Mean : Geo-Mean=(a_1*a_2*…*a_n )^(1/n)=√(n&a_1*a_2* ..*a_n ).
- **TaskGeometricalMean**: Calculate the Geometrical Mean : Geo-Mean =(a<sub>1</sub> × a<sub>2</sub> × ... × a<sub>n</sub>)<sup>1/n</sup>.
- **TaskPrimeNumberFinder**: Finds prime numbers up to a specified limit.
...
...
@@ -59,3 +98,5 @@ k6 run testSingleTaskResponse.js
This project is open-source and available under the MIT License.