Now that we have the auxiliary classes of the executor, we have to implement the executor itself. We have implemented the ServerExecutor class for this purpose. It extends the ThreadPoolExecutor class and has some internal attributes, as follows:
- startTimes: This is a ConcurrentHashMap to store the start date of every task. The key of the class will be the ServerTask object (a Runnable object), and the value will be a Date object.
- executionStatistics: This is a ConcurrentHashMap to store the statistics of use per user. The key will be the username and the value will be an ExecutorStatistics object.
- CORE_POOL_SIZE, MAXIMUM_POOL_SIZE, and KEEP_ALIVE_TIME: These are constants to define the characteristics of the executor.
- REJECTED_TASK_CONTROLLER ...