When you want to finish the execution of an executor, you use the
shutdown() method to indicate that it should finish. The executor waits for the completion of the tasks that are running or waiting for their execution, and then finishes its execution.
If you send a task to an executor between the
shutdown() method and the end of its execution, the task is rejected, because the executor no longer accepts new tasks. The
ThreadPoolExecutor class provides a mechanism, which is called when a task is rejected.
In this recipe, you will learn how to manage rejecting tasks in an executor that is implementing with
The example of this recipe has been implemented using the Eclipse ...