private static <K, V> void insertKeyValueNoLock(Object[] table, int capacity, K key, V value) { int bucket = signSafeMod(hash(key), capacity); while (true) { K storedKey = (K) table[bucket]; if (storedKey == EmptyKey) { // The bucket is empty, so we can use it table[bucket] = key; table[bucket + 1] = value; return; } bucket = (bucket + 2) & (table.length - 1); } } }
private V remove(K key, Object value, int keyHash) { long stamp = writeLock(); int bucket = signSafeMod(keyHash, capacity);
V get(K key, int keyHash) { long stamp = tryOptimisticRead(); boolean acquiredLock = false; int bucket = signSafeMod(keyHash, capacity); acquiredLock = true; bucket = signSafeMod(keyHash, capacity); storedKey = (K) table[bucket]; storedValue = (V) table[bucket + 1];
V put(K key, V value, int keyHash, boolean onlyIfAbsent, Function<K, V> valueProvider) { long stamp = writeLock(); int bucket = signSafeMod(keyHash, capacity);
private static <K, V> void insertKeyValueNoLock(Object[] table, int capacity, K key, V value) { int bucket = signSafeMod(hash(key), capacity); while (true) { K storedKey = (K) table[bucket]; if (storedKey == EmptyKey) { // The bucket is empty, so we can use it table[bucket] = key; table[bucket + 1] = value; return; } bucket = (bucket + 2) & (table.length - 1); } } }
private V remove(K key, Object value, int keyHash) { long stamp = writeLock(); int bucket = signSafeMod(keyHash, capacity);
V get(K key, int keyHash) { long stamp = tryOptimisticRead(); boolean acquiredLock = false; int bucket = signSafeMod(keyHash, capacity); acquiredLock = true; bucket = signSafeMod(keyHash, capacity); storedKey = (K) table[bucket]; storedValue = (V) table[bucket + 1];
V put(K key, V value, int keyHash, boolean onlyIfAbsent, Function<K, V> valueProvider) { long stamp = writeLock(); int bucket = signSafeMod(keyHash, capacity);