V - the type of memory block used as valuepublic class BinaryElasticHashMap<V extends com.hazelcast.memory.MemoryBlock> extends Object implements com.hazelcast.elastic.map.ElasticMap<com.hazelcast.nio.serialization.Data,V>
Data to MemoryBlock, implemented using open
addressing with linear probing for collision resolution.
The internal buffer of this implementation is always allocated to the nearest higher size that is a power of two. When the capacity exceeds the given load factor, the buffer size is doubled.
| Modifier and Type | Class and Description |
|---|---|
protected class |
BinaryElasticHashMap.KeyIter
Key iterator.
|
protected class |
BinaryElasticHashMap.MapEntry
Map.Entry implementation for this map. |
protected class |
BinaryElasticHashMap.RandomKeyIter |
protected class |
BinaryElasticHashMap.RandomValueIter |
protected class |
BinaryElasticHashMap.ValueIter
Iterator over the map's values.
|
| Modifier and Type | Field and Description |
|---|---|
protected BehmSlotAccessor |
accessor |
static int |
HEADER_LENGTH_IN_BYTES
Header length when header stored off-heap for zero heap usage
|
protected MemoryBlockProcessor<V> |
memoryBlockProcessor |
| Constructor and Description |
|---|
BinaryElasticHashMap(EnterpriseSerializationService serializationService,
com.hazelcast.memory.MemoryBlockAccessor<V> memoryBlockAccessor,
com.hazelcast.internal.memory.MemoryAllocator malloc)
Creates a hash map with the default capacity of ,
load factor of .
|
BinaryElasticHashMap(int initialCapacity,
EnterpriseSerializationService serializationService,
com.hazelcast.memory.MemoryBlockAccessor<V> memoryBlockAccessor,
com.hazelcast.internal.memory.MemoryAllocator malloc)
Creates a hash map with the given initial capacity, default load factor of
.
|
BinaryElasticHashMap(int initialCapacity,
float loadFactor,
EnterpriseSerializationService serializationService,
com.hazelcast.memory.MemoryBlockAccessor<V> memoryBlockAccessor,
com.hazelcast.internal.memory.MemoryAllocator malloc)
Creates a hash map with the given initial capacity,
load factor.
|
BinaryElasticHashMap(int initialCapacity,
float loadFactor,
MemoryBlockProcessor<V> memoryBlockProcessor)
Creates a hash map with the given initial capacity,
load factor.
|
BinaryElasticHashMap(int initialCapacity,
MemoryBlockProcessor<V> memoryBlockProcessor)
Creates a hash map with the given initial capacity,
load factor.
|
| Modifier and Type | Method and Description |
|---|---|
int |
capacity() |
void |
clear()
Clears the map by removing and disposing all key/value pairs stored.
|
boolean |
containsKey(Object k) |
boolean |
containsValue(Object v) |
boolean |
delete(com.hazelcast.nio.serialization.Data key) |
void |
dispose()
Disposes internal backing array of this map.
|
Iterator<Map.Entry<com.hazelcast.nio.serialization.Data,V>> |
entryIter(boolean failFast) |
protected com.hazelcast.elastic.SlottableIterator<Map.Entry<com.hazelcast.nio.serialization.Data,V>> |
entryIter(int slot) |
Set<Map.Entry<com.hazelcast.nio.serialization.Data,V>> |
entrySet() |
V |
get(Object k) |
V |
getIfSameKey(Object k) |
long |
getNativeKeyAddress(com.hazelcast.nio.serialization.Data key) |
boolean |
isEmpty() |
protected BinaryElasticHashMap.KeyIter |
keyIter(int startSlot) |
Set<com.hazelcast.nio.serialization.Data> |
keySet() |
static <V extends com.hazelcast.memory.MemoryBlock> |
loadFromOffHeapHeader(EnterpriseSerializationService ss,
com.hazelcast.internal.memory.MemoryAllocator malloc,
long address) |
com.hazelcast.elastic.SlottableIterator<com.hazelcast.nio.serialization.Data> |
newRandomEvictionKeyIterator()
Returns a key iterator indented to be used for forced evictions - iteration order is (pseudo-)random.
|
com.hazelcast.elastic.SlottableIterator<V> |
newRandomEvictionValueIterator()
Returns a key iterator indented to be used for forced evictions - iteration order is (pseudo-)random.
|
protected com.hazelcast.memory.NativeOutOfMemoryError |
onOome(com.hazelcast.memory.NativeOutOfMemoryError e) |
V |
put(com.hazelcast.nio.serialization.Data key,
V value) |
void |
putAll(Map<? extends com.hazelcast.nio.serialization.Data,? extends V> map) |
V |
putIfAbsent(com.hazelcast.nio.serialization.Data key,
V value) |
protected V |
readV(long slotValue) |
V |
remove(Object k) |
boolean |
remove(Object k,
Object v) |
V |
replace(com.hazelcast.nio.serialization.Data key,
V value) |
boolean |
replace(com.hazelcast.nio.serialization.Data key,
V oldValue,
V newValue) |
boolean |
set(com.hazelcast.nio.serialization.Data key,
V value) |
int |
size() |
NativeMemoryData |
storeHeaderOffHeap(com.hazelcast.internal.memory.MemoryAllocator malloc,
long addressGiven) |
String |
toString() |
Iterator<V> |
valueIter() |
Iterator<V> |
valueIter(boolean failFast) |
Collection<V> |
values() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcompute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, replaceAllpublic static final int HEADER_LENGTH_IN_BYTES
protected final MemoryBlockProcessor<V extends com.hazelcast.memory.MemoryBlock> memoryBlockProcessor
protected BehmSlotAccessor accessor
public BinaryElasticHashMap(EnterpriseSerializationService serializationService, com.hazelcast.memory.MemoryBlockAccessor<V> memoryBlockAccessor, com.hazelcast.internal.memory.MemoryAllocator malloc)
public BinaryElasticHashMap(int initialCapacity,
EnterpriseSerializationService serializationService,
com.hazelcast.memory.MemoryBlockAccessor<V> memoryBlockAccessor,
com.hazelcast.internal.memory.MemoryAllocator malloc)
initialCapacity - initial capacity (greater than zero and automatically
rounded to the next power of two)public BinaryElasticHashMap(int initialCapacity,
float loadFactor,
EnterpriseSerializationService serializationService,
com.hazelcast.memory.MemoryBlockAccessor<V> memoryBlockAccessor,
com.hazelcast.internal.memory.MemoryAllocator malloc)
initialCapacity - initial capacity (greater than zero and automatically
rounded to the next power of two)loadFactor - the load factor (greater than zero and smaller than 1)public BinaryElasticHashMap(int initialCapacity,
MemoryBlockProcessor<V> memoryBlockProcessor)
initialCapacity - initial capacity (greater than zero and automatically
rounded to the next power of two)public BinaryElasticHashMap(int initialCapacity,
float loadFactor,
MemoryBlockProcessor<V> memoryBlockProcessor)
initialCapacity - initial capacity (greater than zero and automatically
rounded to the next power of two)loadFactor - the load factor (greater than zero and smaller than 1)protected com.hazelcast.memory.NativeOutOfMemoryError onOome(com.hazelcast.memory.NativeOutOfMemoryError e)
public boolean set(com.hazelcast.nio.serialization.Data key,
V value)
set in interface com.hazelcast.elastic.map.ElasticMap<com.hazelcast.nio.serialization.Data,V extends com.hazelcast.memory.MemoryBlock>public V putIfAbsent(com.hazelcast.nio.serialization.Data key, V value)
putIfAbsent in interface com.hazelcast.elastic.map.ElasticMap<com.hazelcast.nio.serialization.Data,V extends com.hazelcast.memory.MemoryBlock>putIfAbsent in interface Map<com.hazelcast.nio.serialization.Data,V extends com.hazelcast.memory.MemoryBlock>public boolean delete(com.hazelcast.nio.serialization.Data key)
delete in interface com.hazelcast.elastic.map.ElasticMap<com.hazelcast.nio.serialization.Data,V extends com.hazelcast.memory.MemoryBlock>public V getIfSameKey(Object k)
k - must be instanceof NativeMemoryDataget(Object), but with the additional constraint that the argument
must refer to exactly the same blob (at the same address) as the one stored by the mappublic long getNativeKeyAddress(com.hazelcast.nio.serialization.Data key)
public boolean containsKey(Object k)
containsKey in interface Map<com.hazelcast.nio.serialization.Data,V extends com.hazelcast.memory.MemoryBlock>public boolean containsValue(Object v)
containsValue in interface Map<com.hazelcast.nio.serialization.Data,V extends com.hazelcast.memory.MemoryBlock>public com.hazelcast.elastic.SlottableIterator<com.hazelcast.nio.serialization.Data> newRandomEvictionKeyIterator()
public com.hazelcast.elastic.SlottableIterator<V> newRandomEvictionValueIterator()
public Set<com.hazelcast.nio.serialization.Data> keySet()
protected BinaryElasticHashMap.KeyIter keyIter(int startSlot)
public Collection<V> values()
public final Iterator<V> valueIter(boolean failFast)
failFast - true to enable fail fast behaviour, otherwise set falsemodCountprotected V readV(long slotValue)
public final Iterator<Map.Entry<com.hazelcast.nio.serialization.Data,V>> entryIter(boolean failFast)
failFast - true to enable fail fast behaviour, otherwise set falsemodCountprotected com.hazelcast.elastic.SlottableIterator<Map.Entry<com.hazelcast.nio.serialization.Data,V>> entryIter(int slot)
public void clear()
public NativeMemoryData storeHeaderOffHeap(com.hazelcast.internal.memory.MemoryAllocator malloc, long addressGiven)
public static <V extends com.hazelcast.memory.MemoryBlock> BinaryElasticHashMap<V> loadFromOffHeapHeader(EnterpriseSerializationService ss, com.hazelcast.internal.memory.MemoryAllocator malloc, long address)
public void dispose()
clear() must be called explicitly.dispose in interface com.hazelcast.nio.Disposableclear()public int size()
public int capacity()
public boolean isEmpty()
Copyright © 2020 Hazelcast, Inc.. All Rights Reserved.