ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/main/java/util/concurrent/ConcurrentHashMap.java
(Generate patch)

Comparing jsr166/src/main/java/util/concurrent/ConcurrentHashMap.java (file contents):
Revision 1.228 by jsr166, Tue Jun 18 18:39:14 2013 UTC vs.
Revision 1.232 by jsr166, Mon Jul 1 19:19:31 2013 UTC

# Line 262 | Line 262 | public class ConcurrentHashMap<K,V> impl
262       * because they have negative hash fields and null key and value
263       * fields. (These special nodes are either uncommon or transient,
264       * so the impact of carrying around some unused fields is
265 <     * insignficant.)
265 >     * insignificant.)
266       *
267       * The table is lazily initialized to a power-of-two size upon the
268       * first insertion.  Each bin in the table normally contains a
# Line 425 | Line 425 | public class ConcurrentHashMap<K,V> impl
425       *
426       * TreeBins also require an additional locking mechanism.  While
427       * list traversal is always possible by readers even during
428 <     * updates, tree traversal is not, mainly beause of tree-rotations
428 >     * updates, tree traversal is not, mainly because of tree-rotations
429       * that may change the root node and/or its linkages.  TreeBins
430       * include a simple read-write lock mechanism parasitic on the
431       * main bin-synchronization strategy: Structural adjustments
# Line 532 | Line 532 | public class ConcurrentHashMap<K,V> impl
532       * Encodings for Node hash fields. See above for explanation.
533       */
534      static final int MOVED     = 0x8fffffff; // (-1) hash for forwarding nodes
535 <    static final int TREEBIN   = 0x80000000; // hash for heads of treea
535 >    static final int TREEBIN   = 0x80000000; // hash for roots of trees
536      static final int RESERVED  = 0x80000001; // hash for transient reservations
537      static final int HASH_BITS = 0x7fffffff; // usable bits of normal node hash
538  
# Line 552 | Line 552 | public class ConcurrentHashMap<K,V> impl
552       * Key-value entry.  This class is never exported out as a
553       * user-mutable Map.Entry (i.e., one supporting setValue; see
554       * MapEntry below), but can be used for read-only traversals used
555 <     * in bulk tasks.  Subclasses of Node with a negativehash field
555 >     * in bulk tasks.  Subclasses of Node with a negative hash field
556       * are special, and contain null keys and values (but are never
557       * exported).  Otherwise, keys and vals are never null.
558       */
# Line 2542 | Line 2542 | public class ConcurrentHashMap<K,V> impl
2542      }
2543  
2544      /**
2545 <     * Returns a list on non-TreeNodes replacing those in given list
2545 >     * Returns a list on non-TreeNodes replacing those in given list.
2546       */
2547      static <K,V> Node<K,V> untreeify(Node<K,V> b) {
2548          Node<K,V> hd = null, tl = null;
# Line 2680 | Line 2680 | public class ConcurrentHashMap<K,V> impl
2680          }
2681  
2682          /**
2683 <         * Acquires write lock for tree restructuring
2683 >         * Acquires write lock for tree restructuring.
2684           */
2685          private final void lockRoot() {
2686              if (!U.compareAndSwapInt(this, LOCKSTATE, 0, WRITER))
# Line 2688 | Line 2688 | public class ConcurrentHashMap<K,V> impl
2688          }
2689  
2690          /**
2691 <         * Releases write lock for tree restructuring
2691 >         * Releases write lock for tree restructuring.
2692           */
2693          private final void unlockRoot() {
2694              lockState = 0;
2695          }
2696  
2697          /**
2698 <         * Possibly blocks awaiting root lock
2698 >         * Possibly blocks awaiting root lock.
2699           */
2700          private final void contendedLock() {
2701              boolean waiting = false;
# Line 2720 | Line 2720 | public class ConcurrentHashMap<K,V> impl
2720  
2721          /**
2722           * Returns matching node or null if none. Tries to search
2723 <         * using tree compareisons from root, but continues linear
2723 >         * using tree comparisons from root, but continues linear
2724           * search when lock not available.
2725           */
2726          final Node<K,V> find(int h, Object k) {
# Line 2815 | Line 2815 | public class ConcurrentHashMap<K,V> impl
2815           * that are accessible independently of lock. So instead we
2816           * swap the tree linkages.
2817           *
2818 <         * @return true if now too small so should be untreeified.
2818 >         * @return true if now too small, so should be untreeified
2819           */
2820          final boolean removeTreeNode(TreeNode<K,V> p) {
2821              TreeNode<K,V> next = (TreeNode<K,V>)p.next;
# Line 3210 | Line 3210 | public class ConcurrentHashMap<K,V> impl
3210  
3211      /**
3212       * Base of key, value, and entry Iterators. Adds fields to
3213 <     * Traverser to support iterator.remove
3213 >     * Traverser to support iterator.remove.
3214       */
3215      static class BaseIterator<K,V> extends Traverser<K,V> {
3216          final ConcurrentHashMap<K,V> map;
# Line 3573 | Line 3573 | public class ConcurrentHashMap<K,V> impl
3573       * of all (key, value) pairs
3574       * @since 1.8
3575       */
3576 <    public double reduceToDoubleIn(long parallelismThreshold,
3577 <                                   ToDoubleBiFunction<? super K, ? super V> transformer,
3578 <                                   double basis,
3579 <                                   DoubleBinaryOperator reducer) {
3576 >    public double reduceToDouble(long parallelismThreshold,
3577 >                                 ToDoubleBiFunction<? super K, ? super V> transformer,
3578 >                                 double basis,
3579 >                                 DoubleBinaryOperator reducer) {
3580          if (transformer == null || reducer == null)
3581              throw new NullPointerException();
3582          return new MapReduceMappingsToDoubleTask<K,V>

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines