--- jsr166/src/main/intro.html 2003/06/24 14:33:52 1.4 +++ jsr166/src/main/intro.html 2003/06/26 10:46:55 1.6 @@ -57,7 +57,8 @@ flexible thread pool and {@link java.util.concurrent.ScheduledExecutor}, which adds support for delayed and periodic task execution. These, and other Executors can -be used in conjunction with a {@link FutureTask} to asynchronously +be used in conjunction with a {@link java.util.concurrent.FutureTask} +to asynchronously start a potentially long-running computation and query the FutureTask to determine if its execution has completed, or cancel it. @@ -70,10 +71,12 @@ A basic (nonblocking) {@link java.util.Queue} interface extending java.util.Collection is introduced into java.util. Existing class java.util.LinkedList is adapted to support Queue, and a new -non-thread-safe {@link java.util.concurrent.java.util.PriorityQueue} -is added. The java.util.concurrent {@link -java.util.concurrent.LinkedQueue} class supplies an efficient -thread-safe non-blocking queue. +non-thread-safe {@link java.util.PriorityQueue} is added. The +java.util.concurrent {@link +java.util.concurrent.ConcurrentLinkedQueue} class supplies an +efficient sclable thread-safe non-blocking FIFO queue, and {@link +java.util.concurrent.ConcurrentLinkedStack} provides a similar +non-blocking LIFO stack.

Five implementations in java.util.concurrent support the extended {@link java.util.concurrent.BlockingQueue} interface, that defines @@ -81,7 +84,8 @@ java.util.concurrent.LinkedBlockingQueue}, {@link java.util.concurrent.ArrayBlockingQueue}, {@link java.util.concurrent.SynchronousQueue}, {@link -java.util.concurrent.PriorityBlockingQueue}, and {@link DelayQueue}. +java.util.concurrent.PriorityBlockingQueue}, and +{@link java.util.concurrent.DelayQueue}.


@@ -132,21 +136,37 @@ java.util.concurrent.FairSemaphore} are classic concurrency tools. {@link java.util.concurrent.CountDownLatch} is very simple yet very common utility for blocking until a single signal, event, or condition -holds. A {@link CyclicBarrier} is a resettable multiway +holds. A {@link java.util.concurrent.CyclicBarrier} is a resettable multiway synchronization point common in some styles of parallel programming. An {@link java.util.concurrent.Exchanger} allows two threads to exchange objects at a rendezvous point.

Concurrent Collections

-This package supplies a few Collection implementations designed for -use in multithreaded contexts: {@link +Besides Queues, this package supplies a few Collection implementations +designed for use in multithreaded contexts: {@link java.util.concurrent.ConcurrentHashMap}, {@link java.util.concurrent.CopyOnWriteArrayList}, and {@link java.util.concurrent.CopyOnWriteArraySet}. +

The "Concurrent" prefix for classes is a shorthand +indicating several differences from similar "synchronized" +classes. For example java.util.Hashtable and +Collections.synchronizedMap(new HashMap()) are +synchronized. But {@link +java.util.concurrent.ConcurrentHashMap} is "concurrent". +A concurrent collection (among other kinds of classes) is +thread-safe, but not governed by a single exclusion lock. So, in the +particular case of ConcurrentHashMap, it safely permits any number of +concurrent reads as well as a tunable number of concurrent writes. +There may still be a role for "synchronized" classes in some +multithreaded programs -- they can sometimes be useful when you need +to prevent ALL access to a collection via a single lock, at the +expense of much poor scalability. In all other cases, "concurrent" +versions are normally preferable. +

Most concurrent Collection implementations (including most Queues) -differ from the usual java.util conventions in that their Iterators +also differ from the usual java.util conventions in that their Iterators provide weakly consistent rather than fast-fail traversal. A weakly consistent iterator is thread-safe, but does not necessarily freeze the collection while iterating, so it may (or may not) reflect