-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Java 9 Concurrency Cookbook, Second Edition
By :

Before Java 5, the Java Concurrency API, when we wanted to implement a concurrent application, we had to manage the threads by ourselves. First we used to implement the Runnable
interface or an extension of the Thread
class. Then, we used to create a thread
object and start its execution using its start()
method. We also had to control its status to know whether the thread had finished its execution or was still running.
In Java version 5, the concept of executor as a provider of a pool of execution threads appeared. This mechanism, implemented by the Executor
and ExecutorService
interfaces and the ThreadPoolExecutor
and ScheduledThreadPoolExecutor
classes, allows you to concentrate only on the implementation of the logic of the task. You implement the task and send it to the executor. It has a pool of threads, and it is this pool that is responsible for the creation, management, and finalization of the threads. In Java version 7, another...