February 2014
Beginner
1248 pages
62h 25m
English
Figure 23.4 uses an ExecutorService object to manage threads that execute PrintTasks (as defined in Fig. 23.3). Lines 11–13 create and name three PrintTasks to execute. Line 18 uses Executors method newCachedThreadPool to obtain an ExecutorService that’s capable of creating new threads as they’re needed by the application. These threads are used by ExecutorService to execute the Runnables.
1. For detailed information on handling thread interruptions, see Chapter 7 of Java Concurrency in Practice by Brian Goetz, et al., Addison-Wesley Professional, 2006.
Read now
Unlock full access