February 2014
Beginner
1248 pages
62h 25m
English
To allow a Runnable to perform its task, you must execute it. An Executor object executes Runnables. It 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 method ...
Read now
Unlock full access