January 2014
Intermediate to advanced
736 pages
70h 43m
English
To allow a Runnable to perform its task, you must execute it. An Executor object executes Runnables. An Executor does this by creating and managing a group of threads called a thread pool. When an Executor begins executing a Runnable, the Executor calls the Runnable object’s run method, which executes in the new thread.
The Executor interface declares a single method named execute which accepts a Runnable as an argument. The Executor assigns every Runnable passed to its execute method to one of the available threads in the thread pool. If there are no available threads, the Executor creates a new thread or waits for a thread to become available and assigns that thread the Runnable that was passed to ...
Read now
Unlock full access