Customizing the ThreadPoolExecutor class
The Executor framework is a mechanism that allows you to separate the thread creation from its execution. It's based on the
ExecutorService interfaces with the
ThreadPoolExecutor class that implements both interfaces. It has an internal pool of threads and provides methods that allow you to send two kinds of tasks for their execution in the pooled threads. These tasks are:
Runnableinterface to implement tasks that don't return a result
Callableinterface to implement tasks that return a result
In both cases, you only send the task to the executor. The executor uses one of its pooled threads or creates a new one to execute those tasks. The executor also decides the moment in which the ...