The RequestTask class is the intermediary between the ConcurrentServer class, which connects to the clients, and the Executor class, which executes concurrent tasks. It opens the socket with the client, reads the query data, creates the adequate command, and sends it to the executor.
It uses some internal attributes:
- A LinkedBlockingQueue where the ConcurrentServer class stores the client sockets
- A ServerExecutor to execute the commands as concurrent tasks
- A ConcurrentHashMap to store the Future objects associated with the tasks
The constructor of the class initializes all these objects.
public class RequestTask implements Runnable { private LinkedBlockingQueue<Socket> pendingConnections; private ServerExecutor executor ...