Throughout the pages of this chapter, we have used some classes of the Java concurrency API to implement basic functionalities of the executor framework. These classes also have other interesting methods. In this section, we collate some of them.
Executors class provides other methods to create
ThreadPoolExecutor objects. These methods are:
newCachedThreadPool(): This method creates a
ThreadPoolExecutorobject that reuses a worker-thread if it's idle, but it creates a new one if it's necessary. There is no maximum number of worker-threads.
newSingleThreadExecutor(): This method creates a
ThreadPoolExecutorobject that uses only a single worker-thread. The tasks you send to the executor are stored in a queue until the ...