Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Instructions: This project builds upon the TCP file server and client project, and it contains two parts. In the first part, you will need to
Instructions:
This project builds upon the TCP file server and client project, and it contains two parts.
In the first part, you will need to use the Java Executor framework to implement multi
threading. Specifically,
On the client side, the download and the upload commands need to be
executed in separate threads so if a large file is being downloaded or uploaded,
the client can serve other requests in parallel.
On the server side, the download and the upload commands need to be
executed in separate threads as well.
On the server side, provide a way for the server administrator to gracefully
shutdown the server program, as follows:
o Let the administrator type a command egQ to close the server
program.
o Explicitly call the shutdown method on the executor to properly shut
down the thread pool.
o Complete and exit the server program.
Please note that, you are required to use the Java Executor framework to
implement multithreading.
In the second part, you will need to add proper synchronization to allow multiple
threads to upload andor download files without causing any conflicts. This part is more
open ended and you have the freedom to select the synchronization mechanisms such
as mutex locks, condition variables, semaphores, etc. for your implementation.
Consider the following possible synchronization scenarios:
o We will want to allow multiple client threads to download the same file from the
server in parallel.
o If one client thread is uploading, renaming, or deleting a file on the server, no
other client threads should be able to uploadrenamedelete the same file in
parallel.
o If one client is uploading, renaming or deleting a file on the server, no other
client threads should be able to download the same file in parallel.Instructions:
This project builds upon the TCP file server and client project, and it contains two parts.
In the first part, you will need to use the Java Executor framework to implement multi
threading. Specifically,
On the client side, the download and the upload commands need to be
executed in separate threads so if a large file is being downloaded or uploaded,
the client can serve other requests in parallel.
On the server side, the download and the upload commands need to be
executed in separate threads as well.
On the server side, provide a way for the server administrator to gracefully
shutdown the server program, as follows:
o Let the administrator type a command egQ to close the server
program.
o Explicitly call the shutdown method on the executor to properly shut
down the thread pool.
o Complete and exit the server program.
Please note that, you are required to use the Java Executor framework to
implement multithreading.
In the second part, you will need to add proper synchronization to allow multiple
threads to upload andor download files without causing any conflicts. This part is more
open ended and you have the freedom to select the synchronization mechanisms such
as mutex locks, condition variables, semaphores, etc. for your implementation.
Consider the following possible synchronization scenarios:
o We will want to allow multiple client threads to download the same file from the
server in parallel.
o If one client thread is uploading, renaming, or deleting a file on the server, no
other client threads should be able to uploadrenamedelete the same file in
parallel.
o If one client is uploading, renaming or deleting a file on the server, no other
client threads should be able to download the same file in parallel.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started