Java Reference
In-Depth Information
1312936534890: Thread[pool-1-thread-2,5,main]: doing work
1312936534890: Thread[pool-1-thread-3,5,main]: doing work
main thread doing something else
Youmightobservethe main thread doing something else messageap-
pearingbetweenthelast“ entered run() ”messageandthefirst“ doing work
Note For brevity, I have avoided examples that demonstrate CyclicBarrier ,
Exchanger , Phaser ,and Semaphore .Instead,IreferyoutotheJavadocumenta-
how to use the class.
Concurrent Collections
The java.util.concurrent package includes several interfaces and classes that
are concurrency-oriented extensions to the Collections Framework (see Chapter 5 ) :
BlockingDeque is a subinterface of BlockingQueue and
java.util.Deque that also supports blocking operations that wait for the
becomeavailableinthedequebeforestoringanelement.The LinkedBlock-
ingDeque class implements this interface.
BlockingQueue is a subinterface of java.util.Queue that also sup-
storing an element. Each of the ArrayBlockingQueue , DelayQueue ,
LinkedBlockingDeque , LinkedBlockingQueue , LinkedTrans-
ferQueue , PriorityBlockingQueue , and SynchronousQueue
classes implements this interface.
ConcurrentMap is a subinterface of java.util.Map that declares ad-
ditional atomic putIfAbsent() , remove() , and replace() methods.
The ConcurrentHashMap class (the concurrent equivalent of
java.util.HashMap )andthe ConcurrentSkipListMap classimple-
ment this interface.
ConcurrentNavigableMap is a subinterface of ConcurrentMap and
java.util.NavigableMap . The ConcurrentSkipListMap class
implements this interface.
Search WWH ::

Custom Search