--- jsr166/src/jsr166e/ConcurrentHashMapV8.java 2012/11/09 03:30:03 1.76 +++ jsr166/src/jsr166e/ConcurrentHashMapV8.java 2013/02/11 15:25:20 1.94 @@ -21,11 +21,9 @@ import java.util.Enumeration; import java.util.ConcurrentModificationException; import java.util.NoSuchElementException; import java.util.concurrent.ConcurrentMap; -import java.util.concurrent.ThreadLocalRandom; -import java.util.concurrent.locks.LockSupport; import java.util.concurrent.locks.AbstractQueuedSynchronizer; +import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; - import java.io.Serializable; /** @@ -40,7 +38,7 @@ import java.io.Serializable; * interoperable with {@code Hashtable} in programs that rely on its * thread safety but not on its synchronization details. * - *

Retrieval operations (including {@code get}) generally do not + *

Retrieval operations (including {@code get}) generally do not * block, so may overlap with update operations (including {@code put} * and {@code remove}). Retrievals reflect the results of the most * recently completed update operations holding upon their @@ -61,7 +59,7 @@ import java.io.Serializable; * that may be adequate for monitoring or estimation purposes, but not * for program control. * - *

The table is dynamically expanded when there are too many + *

The table is dynamically expanded when there are too many * collisions (i.e., keys that have distinct hash codes but fall into * the same slot modulo the table size), with the expected average * effect of maintaining roughly two bins per mapping (corresponding @@ -82,13 +80,13 @@ import java.io.Serializable; * {@code hashCode()} is a sure way to slow down performance of any * hash table. * - *

A {@link Set} projection of a ConcurrentHashMapV8 may be created + *

A {@link Set} projection of a ConcurrentHashMapV8 may be created * (using {@link #newKeySet()} or {@link #newKeySet(int)}), or viewed * (using {@link #keySet(Object)} when only keys are of interest, and the * mapped values are (perhaps transiently) not used or all take the * same mapping value. * - *

A ConcurrentHashMapV8 can be used as scalable frequency map (a + *

A ConcurrentHashMapV8 can be used as scalable frequency map (a * form of histogram or multiset) by using {@link LongAdder} values * and initializing via {@link #computeIfAbsent}. For example, to add * a count to a {@code ConcurrentHashMapV8 freqs}, you @@ -99,26 +97,26 @@ import java.io.Serializable; * optional methods of the {@link Map} and {@link Iterator} * interfaces. * - *

Like {@link Hashtable} but unlike {@link HashMap}, this class + *

Like {@link Hashtable} but unlike {@link HashMap}, this class * does not allow {@code null} to be used as a key or value. * - *

ConcurrentHashMapV8s support parallel operations using the {@link - * ForkJoinPool#commonPool}. (Tasks that may be used in other contexts - * are available in class {@link ForkJoinTasks}). These operations are - * designed to be safely, and often sensibly, applied even with maps - * that are being concurrently updated by other threads; for example, - * when computing a snapshot summary of the values in a shared - * registry. There are three kinds of operation, each with four - * forms, accepting functions with Keys, Values, Entries, and (Key, - * Value) arguments and/or return values. (The first three forms are - * also available via the {@link #keySet()}, {@link #values()} and - * {@link #entrySet()} views). Because the elements of a - * ConcurrentHashMapV8 are not ordered in any particular way, and may be - * processed in different orders in different parallel executions, the - * correctness of supplied functions should not depend on any - * ordering, or on any other objects or values that may transiently - * change while computation is in progress; and except for forEach - * actions, should ideally be side-effect-free. + *

ConcurrentHashMapV8s support sequential and parallel operations + * bulk operations. (Parallel forms use the {@link + * ForkJoinPool#commonPool()}). Tasks that may be used in other + * contexts are available in class {@link ForkJoinTasks}. These + * operations are designed to be safely, and often sensibly, applied + * even with maps that are being concurrently updated by other + * threads; for example, when computing a snapshot summary of the + * values in a shared registry. There are three kinds of operation, + * each with four forms, accepting functions with Keys, Values, + * Entries, and (Key, Value) arguments and/or return values. Because + * the elements of a ConcurrentHashMapV8 are not ordered in any + * particular way, and may be processed in different orders in + * different parallel executions, the correctness of supplied + * functions should not depend on any ordering, or on any other + * objects or values that may transiently change while computation is + * in progress; and except for forEach actions, should ideally be + * side-effect-free. * *