February 2014
Beginner
1248 pages
62h 25m
English
Class BlockingBufferTest (Fig. 23.15) contains the main method that launches the application. Line 13 creates an ExecutorService, and line 16 creates a BlockingBuffer object and assigns its reference to the Buffer variable sharedLocation. Lines 18–19 execute the Producer and Consumer Runnables. Line 21 calls method shutdown to end the application when the threads finish executing the Producer and Consumer tasks and line 22 waits for the scheduled tasks to complete.
Read now
Unlock full access