299 |
|
* because they have negative hash fields and null key and value |
300 |
|
* fields. (These special nodes are either uncommon or transient, |
301 |
|
* so the impact of carrying around some unused fields is |
302 |
< |
* insignficant.) |
302 |
> |
* insignificant.) |
303 |
|
* |
304 |
|
* The table is lazily initialized to a power-of-two size upon the |
305 |
|
* first insertion. Each bin in the table normally contains a |
462 |
|
* |
463 |
|
* TreeBins also require an additional locking mechanism. While |
464 |
|
* list traversal is always possible by readers even during |
465 |
< |
* updates, tree traversal is not, mainly beause of tree-rotations |
465 |
> |
* updates, tree traversal is not, mainly because of tree-rotations |
466 |
|
* that may change the root node and/or its linkages. TreeBins |
467 |
|
* include a simple read-write lock mechanism parasitic on the |
468 |
|
* main bin-synchronization strategy: Structural adjustments |
569 |
|
* Encodings for Node hash fields. See above for explanation. |
570 |
|
*/ |
571 |
|
static final int MOVED = 0x8fffffff; // (-1) hash for forwarding nodes |
572 |
< |
static final int TREEBIN = 0x80000000; // hash for heads of treea |
572 |
> |
static final int TREEBIN = 0x80000000; // hash for roots of trees |
573 |
|
static final int RESERVED = 0x80000001; // hash for transient reservations |
574 |
|
static final int HASH_BITS = 0x7fffffff; // usable bits of normal node hash |
575 |
|
|
589 |
|
* Key-value entry. This class is never exported out as a |
590 |
|
* user-mutable Map.Entry (i.e., one supporting setValue; see |
591 |
|
* MapEntry below), but can be used for read-only traversals used |
592 |
< |
* in bulk tasks. Subclasses of Node with a negativehash field |
592 |
> |
* in bulk tasks. Subclasses of Node with a negative hash field |
593 |
|
* are special, and contain null keys and values (but are never |
594 |
|
* exported). Otherwise, keys and vals are never null. |
595 |
|
*/ |
2475 |
|
} |
2476 |
|
|
2477 |
|
/** |
2478 |
< |
* Returns a list on non-TreeNodes replacing those in given list |
2478 |
> |
* Returns a list on non-TreeNodes replacing those in given list. |
2479 |
|
*/ |
2480 |
|
static <K,V> Node<K,V> untreeify(Node<K,V> b) { |
2481 |
|
Node<K,V> hd = null, tl = null; |
2613 |
|
} |
2614 |
|
|
2615 |
|
/** |
2616 |
< |
* Acquires write lock for tree restructuring |
2616 |
> |
* Acquires write lock for tree restructuring. |
2617 |
|
*/ |
2618 |
|
private final void lockRoot() { |
2619 |
|
if (!U.compareAndSwapInt(this, LOCKSTATE, 0, WRITER)) |
2621 |
|
} |
2622 |
|
|
2623 |
|
/** |
2624 |
< |
* Releases write lock for tree restructuring |
2624 |
> |
* Releases write lock for tree restructuring. |
2625 |
|
*/ |
2626 |
|
private final void unlockRoot() { |
2627 |
|
lockState = 0; |
2628 |
|
} |
2629 |
|
|
2630 |
|
/** |
2631 |
< |
* Possibly blocks awaiting root lock |
2631 |
> |
* Possibly blocks awaiting root lock. |
2632 |
|
*/ |
2633 |
|
private final void contendedLock() { |
2634 |
|
boolean waiting = false; |
2653 |
|
|
2654 |
|
/** |
2655 |
|
* Returns matching node or null if none. Tries to search |
2656 |
< |
* using tree compareisons from root, but continues linear |
2656 |
> |
* using tree comparisons from root, but continues linear |
2657 |
|
* search when lock not available. |
2658 |
|
*/ |
2659 |
|
final Node<K,V> find(int h, Object k) { |
2751 |
|
* that are accessible independently of lock. So instead we |
2752 |
|
* swap the tree linkages. |
2753 |
|
* |
2754 |
< |
* @return true if now too small so should be untreeified. |
2754 |
> |
* @return true if now too small, so should be untreeified |
2755 |
|
*/ |
2756 |
|
final boolean removeTreeNode(TreeNode<K,V> p) { |
2757 |
|
TreeNode<K,V> next = (TreeNode<K,V>)p.next; |
3146 |
|
|
3147 |
|
/** |
3148 |
|
* Base of key, value, and entry Iterators. Adds fields to |
3149 |
< |
* Traverser to support iterator.remove |
3149 |
> |
* Traverser to support iterator.remove. |
3150 |
|
*/ |
3151 |
|
static class BaseIterator<K,V> extends Traverser<K,V> { |
3152 |
|
final ConcurrentHashMapV8<K,V> map; |
3498 |
|
* of all (key, value) pairs |
3499 |
|
* @since 1.8 |
3500 |
|
*/ |
3501 |
< |
public double reduceToDoubleIn(long parallelismThreshold, |
3502 |
< |
ObjectByObjectToDouble<? super K, ? super V> transformer, |
3503 |
< |
double basis, |
3504 |
< |
DoubleByDoubleToDouble reducer) { |
3501 |
> |
public double reduceToDouble(long parallelismThreshold, |
3502 |
> |
ObjectByObjectToDouble<? super K, ? super V> transformer, |
3503 |
> |
double basis, |
3504 |
> |
DoubleByDoubleToDouble reducer) { |
3505 |
|
if (transformer == null || reducer == null) |
3506 |
|
throw new NullPointerException(); |
3507 |
|
return new MapReduceMappingsToDoubleTask<K,V> |
5986 |
|
} |
5987 |
|
|
5988 |
|
/** |
5989 |
< |
* Generates initial value for per-thread CounterHashCodes |
5989 |
> |
* Generates initial value for per-thread CounterHashCodes. |
5990 |
|
*/ |
5991 |
|
static final AtomicInteger counterHashCodeGenerator = new AtomicInteger(); |
5992 |
|
|