648 |
|
* TreeBins also maintain a separate locking discipline than |
649 |
|
* regular bins. Because they are forwarded via special MOVED |
650 |
|
* nodes at bin heads (which can never change once established), |
651 |
< |
* we cannot use use those nodes as locks. Instead, TreeBin |
651 |
> |
* we cannot use those nodes as locks. Instead, TreeBin |
652 |
|
* extends AbstractQueuedSynchronizer to support a simple form of |
653 |
|
* read-write lock. For update operations and table validation, |
654 |
|
* the exclusive form of lock behaves in the same way as bin-head |
2330 |
|
if (initialCapacity < concurrencyLevel) // Use at least as many bins |
2331 |
|
initialCapacity = concurrencyLevel; // as estimated threads |
2332 |
|
long size = (long)(1.0 + (long)initialCapacity / loadFactor); |
2333 |
< |
int cap = ((size >= (long)MAXIMUM_CAPACITY) ? |
2334 |
< |
MAXIMUM_CAPACITY: tableSizeFor((int)size)); |
2333 |
> |
int cap = (size >= (long)MAXIMUM_CAPACITY) ? |
2334 |
> |
MAXIMUM_CAPACITY : tableSizeFor((int)size); |
2335 |
|
this.counter = new LongAdder(); |
2336 |
|
this.sizeCtl = cap; |
2337 |
|
} |
2940 |
|
|
2941 |
|
/** |
2942 |
|
* Sets our entry's value and writes through to the map. The |
2943 |
< |
* value to return is somewhat arbitrary here. Since a we do |
2944 |
< |
* not necessarily track asynchronous changes, the most recent |
2943 |
> |
* value to return is somewhat arbitrary here. Since we do not |
2944 |
> |
* necessarily track asynchronous changes, the most recent |
2945 |
|
* "previous" value could be different from what we return (or |
2946 |
|
* could even have been removed in which case the put will |
2947 |
|
* re-establish). We do not and cannot guarantee more. |