224 |
|
|
225 |
|
/** |
226 |
|
* A function computing a mapping from the given key to a value, |
227 |
< |
* or {@code null} if there is no mapping. |
227 |
> |
* or {@code null} if there is no mapping. |
228 |
|
*/ |
229 |
|
public static interface MappingFunction<K, V> { |
230 |
|
/** |
245 |
|
/** |
246 |
|
* A function computing a new mapping from the given key and its |
247 |
|
* current value to a new value, or {@code null} if there is |
248 |
< |
* no mapping |
248 |
> |
* no mapping. |
249 |
|
*/ |
250 |
|
public static interface RemappingFunction<K, V> { |
251 |
|
/** |
344 |
|
* Records the linkage to be returned by the next call to getLinkage. |
345 |
|
* @param linkage the linkage |
346 |
|
*/ |
347 |
< |
void setLinkage(Node r); |
347 |
> |
void setLinkage(Node linkage); |
348 |
|
} |
349 |
|
|
350 |
|
/** |
351 |
|
* Each Segment holds a count and table corresponding to a segment |
352 |
|
* of the table. This class contains only those methods for |
353 |
|
* directly assigning these fields, which must only be called |
354 |
< |
* while holding locks |
354 |
> |
* while holding locks. |
355 |
|
*/ |
356 |
|
static final class Segment extends ReentrantLock { |
357 |
|
volatile Node[] table; |
386 |
|
} |
387 |
|
|
388 |
|
/** |
389 |
< |
* See the similar code in ConcurrentHashMap for explanation |
389 |
> |
* See the similar code in ConcurrentHashMap for explanation. |
390 |
|
*/ |
391 |
|
final Node[] resizeTable(CustomConcurrentHashMap cchm) { |
392 |
|
Node[] oldTable = table; |
393 |
|
if (oldTable == null) |
394 |
< |
return table = (Node[]) |
395 |
< |
new Node[cchm.initialSegmentCapacity]; |
394 |
> |
return table = new Node[cchm.initialSegmentCapacity]; |
395 |
|
|
396 |
|
int oldCapacity = oldTable.length; |
397 |
|
if (oldCapacity >= MAX_SEGMENT_CAPACITY) |
398 |
|
return oldTable; |
399 |
< |
Node[] newTable = |
401 |
< |
(Node[])new Node[oldCapacity<<1]; |
399 |
> |
Node[] newTable = new Node[oldCapacity<<1]; |
400 |
|
int sizeMask = newTable.length - 1; |
401 |
|
NodeFactory fac = cchm.factory; |
402 |
|
for (int i = 0; i < oldCapacity ; i++) { |
538 |
|
capacity = MAX_SEGMENT_CAPACITY; |
539 |
|
this.initialSegmentCapacity = capacity; |
540 |
|
} |
541 |
< |
this.segments = (Segment[])new Segment[NSEGMENTS]; |
541 |
> |
this.segments = new Segment[NSEGMENTS]; |
542 |
|
} |
543 |
|
|
544 |
|
/** |
698 |
|
* if no such mapping exists. |
699 |
|
* |
700 |
|
* @param key possible key |
701 |
< |
* @return the value associated with the key or {@code null} if |
702 |
< |
* there is no mapping. |
701 |
> |
* @return the value associated with the key, or {@code null} if |
702 |
> |
* there is no mapping |
703 |
|
* @throws NullPointerException if the specified key is null |
704 |
|
*/ |
705 |
|
public V get(Object key) { |
1090 |
|
* @param mappingFunction the function to compute a value |
1091 |
|
* @return the current (existing or computed) value associated with |
1092 |
|
* the specified key, or {@code null} if the computation |
1093 |
< |
* returned {@code null}. |
1093 |
> |
* returned {@code null} |
1094 |
|
* @throws NullPointerException if the specified key or mappingFunction |
1095 |
< |
* is null, |
1095 |
> |
* is null |
1096 |
|
* @throws RuntimeException or Error if the mappingFunction does so, |
1097 |
< |
* in which case the mapping is left unestablished. |
1097 |
> |
* in which case the mapping is left unestablished |
1098 |
|
*/ |
1099 |
|
public V computeIfAbsent(K key, MappingFunction<? super K, ? extends V> mappingFunction) { |
1100 |
|
if (key == null || mappingFunction == null) |
1165 |
|
* @return the updated value or |
1166 |
|
* {@code null} if the computation returned {@code null} |
1167 |
|
* @throws NullPointerException if the specified key or remappingFunction |
1168 |
< |
* is null, |
1168 |
> |
* is null |
1169 |
|
* @throws RuntimeException or Error if the remappingFunction does so, |
1170 |
|
* in which case the mapping is left in its previous state |
1171 |
|
*/ |
1574 |
|
private void readObject(java.io.ObjectInputStream s) |
1575 |
|
throws IOException, ClassNotFoundException { |
1576 |
|
s.defaultReadObject(); |
1577 |
< |
this.segments = (Segment[])(new Segment[NSEGMENTS]); |
1577 |
> |
this.segments = new Segment[NSEGMENTS]; |
1578 |
|
for (;;) { |
1579 |
|
K key = (K) s.readObject(); |
1580 |
|
V value = (V) s.readObject(); |
1720 |
|
* to {@link java.lang.ref.Reference} constructors to arrange |
1721 |
|
* removal of reclaimed nodes from maps via a background thread. |
1722 |
|
* @return the reference queue associated with the background |
1723 |
< |
* cleanup thread. |
1723 |
> |
* cleanup thread |
1724 |
|
*/ |
1725 |
|
static ReferenceQueue<Object> getReclamationQueue() { |
1726 |
|
ReferenceQueue<Object> q = refQueue; |
1791 |
|
|
1792 |
|
// Strong Keys |
1793 |
|
|
1794 |
< |
static abstract class StrongKeyNode implements Node { |
1794 |
> |
abstract static class StrongKeyNode implements Node { |
1795 |
|
final Object key; |
1796 |
|
final int locator; |
1797 |
|
StrongKeyNode(int locator, Object key) { |
1803 |
|
} |
1804 |
|
|
1805 |
|
|
1806 |
< |
static abstract class StrongKeySelfValueNode |
1806 |
> |
abstract static class StrongKeySelfValueNode |
1807 |
|
extends StrongKeyNode { |
1808 |
|
StrongKeySelfValueNode(int locator, Object key) { |
1809 |
|
super(locator, key); |
1819 |
|
super(locator, key); |
1820 |
|
} |
1821 |
|
public final Node getLinkage() { return null; } |
1822 |
< |
public final void setLinkage(Node r) { } |
1822 |
> |
public final void setLinkage(Node linkage) { } |
1823 |
|
} |
1824 |
|
|
1825 |
|
static final class LinkedStrongKeySelfValueNode |
1831 |
|
this.linkage = linkage; |
1832 |
|
} |
1833 |
|
public final Node getLinkage() { return linkage; } |
1834 |
< |
public final void setLinkage(Node r) { linkage = r; } |
1834 |
> |
public final void setLinkage(Node linkage) { this.linkage = linkage; } |
1835 |
|
} |
1836 |
|
|
1837 |
|
static final class StrongKeySelfValueNodeFactory |
1850 |
|
} |
1851 |
|
} |
1852 |
|
|
1853 |
< |
static abstract class StrongKeyStrongValueNode |
1853 |
> |
abstract static class StrongKeyStrongValueNode |
1854 |
|
extends StrongKeyNode { |
1855 |
|
volatile Object value; |
1856 |
|
StrongKeyStrongValueNode(int locator, Object key, Object value) { |
1869 |
|
super(locator, key, value); |
1870 |
|
} |
1871 |
|
public final Node getLinkage() { return null; } |
1872 |
< |
public final void setLinkage(Node r) { } |
1872 |
> |
public final void setLinkage(Node linkage) { } |
1873 |
|
} |
1874 |
|
|
1875 |
|
static final class LinkedStrongKeyStrongValueNode |
1882 |
|
this.linkage = linkage; |
1883 |
|
} |
1884 |
|
public final Node getLinkage() { return linkage; } |
1885 |
< |
public final void setLinkage(Node r) { linkage = r; } |
1885 |
> |
public final void setLinkage(Node linkage) { this.linkage = linkage; } |
1886 |
|
} |
1887 |
|
|
1888 |
|
static final class StrongKeyStrongValueNodeFactory |
1903 |
|
|
1904 |
|
// ... |
1905 |
|
|
1906 |
< |
static abstract class StrongKeyIntValueNode |
1906 |
> |
abstract static class StrongKeyIntValueNode |
1907 |
|
extends StrongKeyNode { |
1908 |
|
volatile int value; |
1909 |
|
StrongKeyIntValueNode(int locator, Object key, Object value) { |
1924 |
|
super(locator, key, value); |
1925 |
|
} |
1926 |
|
public final Node getLinkage() { return null; } |
1927 |
< |
public final void setLinkage(Node r) { } |
1927 |
> |
public final void setLinkage(Node linkage) { } |
1928 |
|
} |
1929 |
|
|
1930 |
|
static final class LinkedStrongKeyIntValueNode |
1937 |
|
this.linkage = linkage; |
1938 |
|
} |
1939 |
|
public final Node getLinkage() { return linkage; } |
1940 |
< |
public final void setLinkage(Node r) { linkage = r; } |
1940 |
> |
public final void setLinkage(Node linkage) { this.linkage = linkage; } |
1941 |
|
} |
1942 |
|
|
1943 |
|
static final class StrongKeyIntValueNodeFactory |
1958 |
|
|
1959 |
|
// ... |
1960 |
|
|
1961 |
< |
static abstract class StrongKeyWeakValueNode |
1961 |
> |
abstract static class StrongKeyWeakValueNode |
1962 |
|
extends StrongKeyNode { |
1963 |
|
volatile EmbeddedWeakReference valueRef; |
1964 |
|
final CustomConcurrentHashMap cchm; |
1992 |
|
super(locator, key, value, cchm); |
1993 |
|
} |
1994 |
|
public final Node getLinkage() { return null; } |
1995 |
< |
public final void setLinkage(Node r) { } |
1995 |
> |
public final void setLinkage(Node linkage) { } |
1996 |
|
} |
1997 |
|
|
1998 |
|
static final class LinkedStrongKeyWeakValueNode |
2006 |
|
this.linkage = linkage; |
2007 |
|
} |
2008 |
|
public final Node getLinkage() { return linkage; } |
2009 |
< |
public final void setLinkage(Node r) { linkage = r; } |
2009 |
> |
public final void setLinkage(Node linkage) { this.linkage = linkage; } |
2010 |
|
} |
2011 |
|
|
2012 |
|
static final class StrongKeyWeakValueNodeFactory |
2026 |
|
} |
2027 |
|
|
2028 |
|
|
2029 |
< |
static abstract class StrongKeySoftValueNode |
2029 |
> |
abstract static class StrongKeySoftValueNode |
2030 |
|
extends StrongKeyNode { |
2031 |
|
volatile EmbeddedSoftReference valueRef; |
2032 |
|
final CustomConcurrentHashMap cchm; |
2060 |
|
super(locator, key, value, cchm); |
2061 |
|
} |
2062 |
|
public final Node getLinkage() { return null; } |
2063 |
< |
public final void setLinkage(Node r) { } |
2063 |
> |
public final void setLinkage(Node linkage) { } |
2064 |
|
} |
2065 |
|
|
2066 |
|
static final class LinkedStrongKeySoftValueNode |
2074 |
|
this.linkage = linkage; |
2075 |
|
} |
2076 |
|
public final Node getLinkage() { return linkage; } |
2077 |
< |
public final void setLinkage(Node r) { linkage = r; } |
2077 |
> |
public final void setLinkage(Node linkage) { this.linkage = linkage; } |
2078 |
|
} |
2079 |
|
|
2080 |
|
static final class StrongKeySoftValueNodeFactory |
2095 |
|
|
2096 |
|
// Weak keys |
2097 |
|
|
2098 |
< |
static abstract class WeakKeyNode extends WeakReference |
2098 |
> |
abstract static class WeakKeyNode extends WeakReference |
2099 |
|
implements Node { |
2100 |
|
final int locator; |
2101 |
|
final CustomConcurrentHashMap cchm; |
2111 |
|
} |
2112 |
|
} |
2113 |
|
|
2114 |
< |
static abstract class WeakKeySelfValueNode |
2114 |
> |
abstract static class WeakKeySelfValueNode |
2115 |
|
extends WeakKeyNode { |
2116 |
|
WeakKeySelfValueNode(int locator, Object key, |
2117 |
|
CustomConcurrentHashMap cchm) { |
2128 |
|
super(locator, key, cchm); |
2129 |
|
} |
2130 |
|
public final Node getLinkage() { return null; } |
2131 |
< |
public final void setLinkage(Node r) { } |
2131 |
> |
public final void setLinkage(Node linkage) { } |
2132 |
|
} |
2133 |
|
|
2134 |
|
static final class LinkedWeakKeySelfValueNode |
2141 |
|
this.linkage = linkage; |
2142 |
|
} |
2143 |
|
public final Node getLinkage() { return linkage; } |
2144 |
< |
public final void setLinkage(Node r) { linkage = r; } |
2144 |
> |
public final void setLinkage(Node linkage) { this.linkage = linkage; } |
2145 |
|
} |
2146 |
|
|
2147 |
|
static final class WeakKeySelfValueNodeFactory |
2161 |
|
} |
2162 |
|
|
2163 |
|
|
2164 |
< |
static abstract class WeakKeyStrongValueNode |
2164 |
> |
abstract static class WeakKeyStrongValueNode |
2165 |
|
extends WeakKeyNode { |
2166 |
|
volatile Object value; |
2167 |
|
WeakKeyStrongValueNode(int locator, Object key, Object value, |
2181 |
|
super(locator, key, value, cchm); |
2182 |
|
} |
2183 |
|
public final Node getLinkage() { return null; } |
2184 |
< |
public final void setLinkage(Node r) { } |
2184 |
> |
public final void setLinkage(Node linkage) { } |
2185 |
|
} |
2186 |
|
|
2187 |
|
static final class LinkedWeakKeyStrongValueNode |
2195 |
|
this.linkage = linkage; |
2196 |
|
} |
2197 |
|
public final Node getLinkage() { return linkage; } |
2198 |
< |
public final void setLinkage(Node r) { linkage = r; } |
2198 |
> |
public final void setLinkage(Node linkage) { this.linkage = linkage; } |
2199 |
|
} |
2200 |
|
|
2201 |
|
static final class WeakKeyStrongValueNodeFactory |
2214 |
|
} |
2215 |
|
} |
2216 |
|
|
2217 |
< |
static abstract class WeakKeyIntValueNode |
2217 |
> |
abstract static class WeakKeyIntValueNode |
2218 |
|
extends WeakKeyNode { |
2219 |
|
volatile int value; |
2220 |
|
WeakKeyIntValueNode(int locator, Object key, Object value, |
2236 |
|
super(locator, key, value, cchm); |
2237 |
|
} |
2238 |
|
public final Node getLinkage() { return null; } |
2239 |
< |
public final void setLinkage(Node r) { } |
2239 |
> |
public final void setLinkage(Node linkage) { } |
2240 |
|
} |
2241 |
|
|
2242 |
|
static final class LinkedWeakKeyIntValueNode |
2250 |
|
this.linkage = linkage; |
2251 |
|
} |
2252 |
|
public final Node getLinkage() { return linkage; } |
2253 |
< |
public final void setLinkage(Node r) { linkage = r; } |
2253 |
> |
public final void setLinkage(Node linkage) { this.linkage = linkage; } |
2254 |
|
} |
2255 |
|
|
2256 |
|
static final class WeakKeyIntValueNodeFactory |
2269 |
|
} |
2270 |
|
} |
2271 |
|
|
2272 |
< |
static abstract class WeakKeyWeakValueNode |
2272 |
> |
abstract static class WeakKeyWeakValueNode |
2273 |
|
extends WeakKeyNode { |
2274 |
|
volatile EmbeddedWeakReference valueRef; |
2275 |
|
WeakKeyWeakValueNode(int locator, Object key, Object value, |
2298 |
|
super(locator, key, value, cchm); |
2299 |
|
} |
2300 |
|
public final Node getLinkage() { return null; } |
2301 |
< |
public final void setLinkage(Node r) { } |
2301 |
> |
public final void setLinkage(Node linkage) { } |
2302 |
|
} |
2303 |
|
|
2304 |
|
static final class LinkedWeakKeyWeakValueNode |
2312 |
|
this.linkage = linkage; |
2313 |
|
} |
2314 |
|
public final Node getLinkage() { return linkage; } |
2315 |
< |
public final void setLinkage(Node r) { linkage = r; } |
2315 |
> |
public final void setLinkage(Node linkage) { this.linkage = linkage; } |
2316 |
|
} |
2317 |
|
|
2318 |
|
static final class WeakKeyWeakValueNodeFactory |
2332 |
|
} |
2333 |
|
|
2334 |
|
|
2335 |
< |
static abstract class WeakKeySoftValueNode |
2335 |
> |
abstract static class WeakKeySoftValueNode |
2336 |
|
extends WeakKeyNode { |
2337 |
|
volatile EmbeddedSoftReference valueRef; |
2338 |
|
WeakKeySoftValueNode(int locator, Object key, Object value, |
2361 |
|
super(locator, key, value, cchm); |
2362 |
|
} |
2363 |
|
public final Node getLinkage() { return null; } |
2364 |
< |
public final void setLinkage(Node r) { } |
2364 |
> |
public final void setLinkage(Node linkage) { } |
2365 |
|
} |
2366 |
|
|
2367 |
|
static final class LinkedWeakKeySoftValueNode |
2375 |
|
this.linkage = linkage; |
2376 |
|
} |
2377 |
|
public final Node getLinkage() { return linkage; } |
2378 |
< |
public final void setLinkage(Node r) { linkage = r; } |
2378 |
> |
public final void setLinkage(Node linkage) { this.linkage = linkage; } |
2379 |
|
} |
2380 |
|
|
2381 |
|
static final class WeakKeySoftValueNodeFactory |
2396 |
|
|
2397 |
|
// Soft keys |
2398 |
|
|
2399 |
< |
static abstract class SoftKeyNode extends SoftReference |
2399 |
> |
abstract static class SoftKeyNode extends SoftReference |
2400 |
|
implements Node { |
2401 |
|
final int locator; |
2402 |
|
final CustomConcurrentHashMap cchm; |
2412 |
|
} |
2413 |
|
} |
2414 |
|
|
2415 |
< |
static abstract class SoftKeySelfValueNode |
2415 |
> |
abstract static class SoftKeySelfValueNode |
2416 |
|
extends SoftKeyNode { |
2417 |
|
SoftKeySelfValueNode(int locator, Object key, |
2418 |
|
CustomConcurrentHashMap cchm) { |
2429 |
|
super(locator, key, cchm); |
2430 |
|
} |
2431 |
|
public final Node getLinkage() { return null; } |
2432 |
< |
public final void setLinkage(Node r) { } |
2432 |
> |
public final void setLinkage(Node linkage) { } |
2433 |
|
} |
2434 |
|
|
2435 |
|
static final class LinkedSoftKeySelfValueNode |
2442 |
|
this.linkage = linkage; |
2443 |
|
} |
2444 |
|
public final Node getLinkage() { return linkage; } |
2445 |
< |
public final void setLinkage(Node r) { linkage = r; } |
2445 |
> |
public final void setLinkage(Node linkage) { this.linkage = linkage; } |
2446 |
|
} |
2447 |
|
|
2448 |
|
static final class SoftKeySelfValueNodeFactory |
2462 |
|
} |
2463 |
|
|
2464 |
|
|
2465 |
< |
static abstract class SoftKeyStrongValueNode |
2465 |
> |
abstract static class SoftKeyStrongValueNode |
2466 |
|
extends SoftKeyNode { |
2467 |
|
volatile Object value; |
2468 |
|
SoftKeyStrongValueNode(int locator, Object key, Object value, |
2482 |
|
super(locator, key, value, cchm); |
2483 |
|
} |
2484 |
|
public final Node getLinkage() { return null; } |
2485 |
< |
public final void setLinkage(Node r) { } |
2485 |
> |
public final void setLinkage(Node linkage) { } |
2486 |
|
} |
2487 |
|
|
2488 |
|
static final class LinkedSoftKeyStrongValueNode |
2496 |
|
this.linkage = linkage; |
2497 |
|
} |
2498 |
|
public final Node getLinkage() { return linkage; } |
2499 |
< |
public final void setLinkage(Node r) { linkage = r; } |
2499 |
> |
public final void setLinkage(Node linkage) { this.linkage = linkage; } |
2500 |
|
} |
2501 |
|
|
2502 |
|
static final class SoftKeyStrongValueNodeFactory |
2515 |
|
} |
2516 |
|
} |
2517 |
|
|
2518 |
< |
static abstract class SoftKeyIntValueNode |
2518 |
> |
abstract static class SoftKeyIntValueNode |
2519 |
|
extends SoftKeyNode { |
2520 |
|
volatile int value; |
2521 |
|
SoftKeyIntValueNode(int locator, Object key, Object value, |
2537 |
|
super(locator, key, value, cchm); |
2538 |
|
} |
2539 |
|
public final Node getLinkage() { return null; } |
2540 |
< |
public final void setLinkage(Node r) { } |
2540 |
> |
public final void setLinkage(Node linkage) { } |
2541 |
|
} |
2542 |
|
|
2543 |
|
static final class LinkedSoftKeyIntValueNode |
2551 |
|
this.linkage = linkage; |
2552 |
|
} |
2553 |
|
public final Node getLinkage() { return linkage; } |
2554 |
< |
public final void setLinkage(Node r) { linkage = r; } |
2554 |
> |
public final void setLinkage(Node linkage) { this.linkage = linkage; } |
2555 |
|
} |
2556 |
|
|
2557 |
|
static final class SoftKeyIntValueNodeFactory |
2570 |
|
} |
2571 |
|
} |
2572 |
|
|
2573 |
< |
static abstract class SoftKeyWeakValueNode |
2573 |
> |
abstract static class SoftKeyWeakValueNode |
2574 |
|
extends SoftKeyNode { |
2575 |
|
volatile EmbeddedWeakReference valueRef; |
2576 |
|
SoftKeyWeakValueNode(int locator, Object key, Object value, |
2599 |
|
super(locator, key, value, cchm); |
2600 |
|
} |
2601 |
|
public final Node getLinkage() { return null; } |
2602 |
< |
public final void setLinkage(Node r) { } |
2602 |
> |
public final void setLinkage(Node linkage) { } |
2603 |
|
} |
2604 |
|
|
2605 |
|
static final class LinkedSoftKeyWeakValueNode |
2613 |
|
this.linkage = linkage; |
2614 |
|
} |
2615 |
|
public final Node getLinkage() { return linkage; } |
2616 |
< |
public final void setLinkage(Node r) { linkage = r; } |
2616 |
> |
public final void setLinkage(Node linkage) { this.linkage = linkage; } |
2617 |
|
} |
2618 |
|
|
2619 |
|
static final class SoftKeyWeakValueNodeFactory |
2633 |
|
} |
2634 |
|
|
2635 |
|
|
2636 |
< |
static abstract class SoftKeySoftValueNode |
2636 |
> |
abstract static class SoftKeySoftValueNode |
2637 |
|
extends SoftKeyNode { |
2638 |
|
volatile EmbeddedSoftReference valueRef; |
2639 |
|
SoftKeySoftValueNode(int locator, Object key, Object value, |
2662 |
|
super(locator, key, value, cchm); |
2663 |
|
} |
2664 |
|
public final Node getLinkage() { return null; } |
2665 |
< |
public final void setLinkage(Node r) { } |
2665 |
> |
public final void setLinkage(Node linkage) { } |
2666 |
|
} |
2667 |
|
|
2668 |
|
static final class LinkedSoftKeySoftValueNode |
2676 |
|
this.linkage = linkage; |
2677 |
|
} |
2678 |
|
public final Node getLinkage() { return linkage; } |
2679 |
< |
public final void setLinkage(Node r) { linkage = r; } |
2679 |
> |
public final void setLinkage(Node linkage) { this.linkage = linkage; } |
2680 |
|
} |
2681 |
|
|
2682 |
|
static final class SoftKeySoftValueNodeFactory |
2695 |
|
} |
2696 |
|
} |
2697 |
|
|
2698 |
< |
static abstract class IntKeyNode implements Node { |
2698 |
> |
abstract static class IntKeyNode implements Node { |
2699 |
|
final int key; |
2700 |
|
IntKeyNode(int locator, Object key) { |
2701 |
|
this.key = ((Integer)key).intValue(); |
2705 |
|
} |
2706 |
|
|
2707 |
|
|
2708 |
< |
static abstract class IntKeySelfValueNode |
2708 |
> |
abstract static class IntKeySelfValueNode |
2709 |
|
extends IntKeyNode { |
2710 |
|
IntKeySelfValueNode(int locator, Object key) { |
2711 |
|
super(locator, key); |
2721 |
|
super(locator, key); |
2722 |
|
} |
2723 |
|
public final Node getLinkage() { return null; } |
2724 |
< |
public final void setLinkage(Node r) { } |
2724 |
> |
public final void setLinkage(Node linkage) { } |
2725 |
|
} |
2726 |
|
|
2727 |
|
static final class LinkedIntKeySelfValueNode |
2733 |
|
this.linkage = linkage; |
2734 |
|
} |
2735 |
|
public final Node getLinkage() { return linkage; } |
2736 |
< |
public final void setLinkage(Node r) { linkage = r; } |
2736 |
> |
public final void setLinkage(Node linkage) { this.linkage = linkage; } |
2737 |
|
} |
2738 |
|
|
2739 |
|
static final class IntKeySelfValueNodeFactory |
2752 |
|
} |
2753 |
|
} |
2754 |
|
|
2755 |
< |
static abstract class IntKeyStrongValueNode |
2755 |
> |
abstract static class IntKeyStrongValueNode |
2756 |
|
extends IntKeyNode { |
2757 |
|
volatile Object value; |
2758 |
|
IntKeyStrongValueNode(int locator, Object key, Object value) { |
2771 |
|
super(locator, key, value); |
2772 |
|
} |
2773 |
|
public final Node getLinkage() { return null; } |
2774 |
< |
public final void setLinkage(Node r) { } |
2774 |
> |
public final void setLinkage(Node linkage) { } |
2775 |
|
} |
2776 |
|
|
2777 |
|
static final class LinkedIntKeyStrongValueNode |
2784 |
|
this.linkage = linkage; |
2785 |
|
} |
2786 |
|
public final Node getLinkage() { return linkage; } |
2787 |
< |
public final void setLinkage(Node r) { linkage = r; } |
2787 |
> |
public final void setLinkage(Node linkage) { this.linkage = linkage; } |
2788 |
|
} |
2789 |
|
|
2790 |
|
static final class IntKeyStrongValueNodeFactory |
2803 |
|
} |
2804 |
|
} |
2805 |
|
|
2806 |
< |
static abstract class IntKeyIntValueNode |
2806 |
> |
abstract static class IntKeyIntValueNode |
2807 |
|
extends IntKeyNode { |
2808 |
|
volatile int value; |
2809 |
|
IntKeyIntValueNode(int locator, Object key, Object value) { |
2824 |
|
super(locator, key, value); |
2825 |
|
} |
2826 |
|
public final Node getLinkage() { return null; } |
2827 |
< |
public final void setLinkage(Node r) { } |
2827 |
> |
public final void setLinkage(Node linkage) { } |
2828 |
|
} |
2829 |
|
|
2830 |
|
static final class LinkedIntKeyIntValueNode |
2837 |
|
this.linkage = linkage; |
2838 |
|
} |
2839 |
|
public final Node getLinkage() { return linkage; } |
2840 |
< |
public final void setLinkage(Node r) { linkage = r; } |
2840 |
> |
public final void setLinkage(Node linkage) { this.linkage = linkage; } |
2841 |
|
} |
2842 |
|
|
2843 |
|
static final class IntKeyIntValueNodeFactory |
2856 |
|
} |
2857 |
|
} |
2858 |
|
|
2859 |
< |
static abstract class IntKeyWeakValueNode |
2859 |
> |
abstract static class IntKeyWeakValueNode |
2860 |
|
extends IntKeyNode { |
2861 |
|
volatile EmbeddedWeakReference valueRef; |
2862 |
|
final CustomConcurrentHashMap cchm; |
2890 |
|
super(locator, key, value, cchm); |
2891 |
|
} |
2892 |
|
public final Node getLinkage() { return null; } |
2893 |
< |
public final void setLinkage(Node r) { } |
2893 |
> |
public final void setLinkage(Node linkage) { } |
2894 |
|
} |
2895 |
|
|
2896 |
|
static final class LinkedIntKeyWeakValueNode |
2904 |
|
this.linkage = linkage; |
2905 |
|
} |
2906 |
|
public final Node getLinkage() { return linkage; } |
2907 |
< |
public final void setLinkage(Node r) { linkage = r; } |
2907 |
> |
public final void setLinkage(Node linkage) { this.linkage = linkage; } |
2908 |
|
} |
2909 |
|
|
2910 |
|
static final class IntKeyWeakValueNodeFactory |
2924 |
|
} |
2925 |
|
|
2926 |
|
|
2927 |
< |
static abstract class IntKeySoftValueNode |
2927 |
> |
abstract static class IntKeySoftValueNode |
2928 |
|
extends IntKeyNode { |
2929 |
|
volatile EmbeddedSoftReference valueRef; |
2930 |
|
final CustomConcurrentHashMap cchm; |
2958 |
|
super(locator, key, value, cchm); |
2959 |
|
} |
2960 |
|
public final Node getLinkage() { return null; } |
2961 |
< |
public final void setLinkage(Node r) { } |
2961 |
> |
public final void setLinkage(Node linkage) { } |
2962 |
|
} |
2963 |
|
|
2964 |
|
static final class LinkedIntKeySoftValueNode |
2972 |
|
this.linkage = linkage; |
2973 |
|
} |
2974 |
|
public final Node getLinkage() { return linkage; } |
2975 |
< |
public final void setLinkage(Node r) { linkage = r; } |
2975 |
> |
public final void setLinkage(Node linkage) { this.linkage = linkage; } |
2976 |
|
} |
2977 |
|
|
2978 |
|
static final class IntKeySoftValueNodeFactory |
3005 |
|
try { |
3006 |
|
UNSAFE = getUnsafe(); |
3007 |
|
tableBase = UNSAFE.arrayBaseOffset(Node[].class); |
3008 |
< |
int s = UNSAFE.arrayIndexScale(Node[].class); |
3009 |
< |
if ((s & (s-1)) != 0) |
3008 |
> |
int scale = UNSAFE.arrayIndexScale(Node[].class); |
3009 |
> |
if ((scale & (scale - 1)) != 0) |
3010 |
|
throw new Error("data type scale not a power of two"); |
3011 |
< |
tableShift = 31 - Integer.numberOfLeadingZeros(s); |
3011 |
> |
tableShift = 31 - Integer.numberOfLeadingZeros(scale); |
3012 |
|
segmentsBase = UNSAFE.arrayBaseOffset(Segment[].class); |
3013 |
< |
s = UNSAFE.arrayIndexScale(Segment[].class); |
3014 |
< |
if ((s & (s-1)) != 0) |
3013 |
> |
scale = UNSAFE.arrayIndexScale(Segment[].class); |
3014 |
> |
if ((scale & (scale - 1)) != 0) |
3015 |
|
throw new Error("data type scale not a power of two"); |
3016 |
< |
segmentsShift = 31 - Integer.numberOfLeadingZeros(s); |
3016 |
> |
segmentsShift = 31 - Integer.numberOfLeadingZeros(scale); |
3017 |
|
} catch (Throwable e) { |
3018 |
|
throw new RuntimeException("Could not initialize intrinsics", e); |
3019 |
|
} |