In this chapter, we presented two examples that explored advanced characteristics of executors. In the first example, we continued with the client/server example of Chapter 2, Managing Lots of Threads – Executors. We implemented our own executor extending the
ThreadPoolExecutor class to execute the tasks by priority and to measure the executing time of the tasks per user. We also included a new command to allow the cancellation of tasks.
In the second example, we explained how to use the
ScheduledThreadPoolExecutor class to execute periodic tasks. We implemented two versions of a news reader. The first one showed how to use the basic functionality of the
ScheduledExecutorService, and the second one showed how to override the behavior of ...