org.terracotta.offheapstore
Class AbstractLockedOffHeapHashMap<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
org.terracotta.offheapstore.OffHeapHashMap<K,V>
org.terracotta.offheapstore.AbstractLockedOffHeapHashMap<K,V>
- Type Parameters:
K - the type of keys maintained by this mapV - the type of mapped values
- All Implemented Interfaces:
- ConcurrentMap<K,V>, ReadWriteLock, Map<K,V>, MapInternals, Segment<K,V>, StorageEngine.Owner
- Direct Known Subclasses:
- AbstractOffHeapClockCache, AbstractPersistentLockedOffHeapHashMap, ReadWriteLockedOffHeapHashMap, WriteLockedOffHeapHashMap
public abstract class AbstractLockedOffHeapHashMap<K,V>
- extends OffHeapHashMap<K,V>
- implements Segment<K,V>
An abstract locked off-heap map.
Subclasses must implement the readLock() and writeLock()
methods such that they return the correct locks under which read and write
operations must occur.
- Author:
- Chris Dennis
| Nested classes/interfaces inherited from interface java.util.Map |
Map.Entry<K,V> |
| Fields inherited from class org.terracotta.offheapstore.OffHeapHashMap |
ENTRY_SIZE, hashtable, hashTablePage, modCount, removedSlots, reprobeLimit, RESERVED_STATUS_BITS, size, STATUS, STATUS_USED, storageEngine, tableSource |
|
Constructor Summary |
AbstractLockedOffHeapHashMap(PageSource source,
boolean tableAllocationsSteal,
StorageEngine<? super K,? super V> storageEngine)
|
AbstractLockedOffHeapHashMap(PageSource source,
boolean tableAllocationsSteal,
StorageEngine<? super K,? super V> storageEngine,
int tableSize)
|
AbstractLockedOffHeapHashMap(PageSource source,
StorageEngine<? super K,? super V> storageEngine)
|
AbstractLockedOffHeapHashMap(PageSource source,
StorageEngine<? super K,? super V> storageEngine,
boolean bootstrap)
|
AbstractLockedOffHeapHashMap(PageSource source,
StorageEngine<? super K,? super V> storageEngine,
int tableSize)
|
AbstractLockedOffHeapHashMap(PageSource source,
StorageEngine<? super K,? super V> storageEngine,
int tableSize,
boolean bootstrap)
|
|
Method Summary |
void |
clear()
|
boolean |
containsKey(Object key)
|
void |
destroy()
|
Set<Map.Entry<K,V>> |
entrySet()
|
boolean |
evict(int index,
boolean shrink)
|
V |
fill(K key,
V value)
Associates the specified value with the specified key in this map. |
V |
fill(K key,
V value,
int metadata)
|
V |
get(Object key)
|
Integer |
getAndSetMetadata(Object key,
int mask,
int values)
|
Long |
getEncodingForHashAndBinary(int hash,
ByteBuffer binaryKey)
|
Integer |
getMetadata(Object key,
int mask)
|
V |
getValueAndSetMetadata(Object key,
int mask,
int values)
|
long |
installMappingForHashAndEncoding(int pojoHash,
ByteBuffer offheapBinaryKey,
ByteBuffer offheapBinaryValue,
int metadata)
|
Set<K> |
keySet()
|
V |
put(K key,
V value)
|
V |
put(K key,
V value,
int metadata)
|
V |
putIfAbsent(K key,
V value)
|
abstract Lock |
readLock()
|
V |
remove(Object key)
|
boolean |
remove(Object key,
Object value)
|
protected boolean |
removeMapping(Object o)
|
boolean |
removeNoReturn(Object key)
|
V |
replace(K key,
V value)
|
boolean |
replace(K key,
V oldValue,
V newValue)
|
boolean |
shrink()
|
int |
size()
|
Collection<V> |
values()
|
abstract Lock |
writeLock()
|
| Methods inherited from class org.terracotta.offheapstore.OffHeapHashMap |
added, encodingSet, fill, getAllocatedMemory, getAtTableOffset, getDataAllocatedMemory, getDataOccupiedMemory, getDataSize, getDataVitalMemory, getEntryAtTableOffset, getOccupiedMemory, getRemovedSlotCount, getReprobeLength, getSize, getSlotForHashAndEncoding, getStorageEngine, getTableCapacity, getUsedSlotCount, getVitalMemory, hit, isAvailable, isPresent, isRemoved, isTerminating, isThiefForTableAllocations, removeAtTableOffset, removed, spread, storageEngineFailure, tableExpansionFailure, tryIncreaseReprobe, updated, updateEncoding |
| Methods inherited from interface org.terracotta.offheapstore.Segment |
getLock |
| Methods inherited from interface org.terracotta.offheapstore.MapInternals |
getAllocatedMemory, getDataAllocatedMemory, getDataOccupiedMemory, getDataSize, getDataVitalMemory, getOccupiedMemory, getRemovedSlotCount, getReprobeLength, getSize, getTableCapacity, getUsedSlotCount, getVitalMemory |
AbstractLockedOffHeapHashMap
public AbstractLockedOffHeapHashMap(PageSource source,
StorageEngine<? super K,? super V> storageEngine)
AbstractLockedOffHeapHashMap
public AbstractLockedOffHeapHashMap(PageSource source,
boolean tableAllocationsSteal,
StorageEngine<? super K,? super V> storageEngine)
AbstractLockedOffHeapHashMap
public AbstractLockedOffHeapHashMap(PageSource source,
StorageEngine<? super K,? super V> storageEngine,
boolean bootstrap)
AbstractLockedOffHeapHashMap
public AbstractLockedOffHeapHashMap(PageSource source,
StorageEngine<? super K,? super V> storageEngine,
int tableSize)
AbstractLockedOffHeapHashMap
public AbstractLockedOffHeapHashMap(PageSource source,
boolean tableAllocationsSteal,
StorageEngine<? super K,? super V> storageEngine,
int tableSize)
AbstractLockedOffHeapHashMap
public AbstractLockedOffHeapHashMap(PageSource source,
StorageEngine<? super K,? super V> storageEngine,
int tableSize,
boolean bootstrap)
size
public int size()
- Specified by:
size in interface Map<K,V>- Overrides:
size in class OffHeapHashMap<K,V>
containsKey
public boolean containsKey(Object key)
- Specified by:
containsKey in interface Map<K,V>- Overrides:
containsKey in class OffHeapHashMap<K,V>
get
public V get(Object key)
- Specified by:
get in interface Map<K,V>- Overrides:
get in class OffHeapHashMap<K,V>
getEncodingForHashAndBinary
public Long getEncodingForHashAndBinary(int hash,
ByteBuffer binaryKey)
- Specified by:
getEncodingForHashAndBinary in interface StorageEngine.Owner- Overrides:
getEncodingForHashAndBinary in class OffHeapHashMap<K,V>
installMappingForHashAndEncoding
public long installMappingForHashAndEncoding(int pojoHash,
ByteBuffer offheapBinaryKey,
ByteBuffer offheapBinaryValue,
int metadata)
- Specified by:
installMappingForHashAndEncoding in interface StorageEngine.Owner- Overrides:
installMappingForHashAndEncoding in class OffHeapHashMap<K,V>
put
public V put(K key,
V value)
- Specified by:
put in interface Map<K,V>- Overrides:
put in class OffHeapHashMap<K,V>
put
public V put(K key,
V value,
int metadata)
- Specified by:
put in interface Segment<K,V>- Overrides:
put in class OffHeapHashMap<K,V>
fill
public V fill(K key,
V value)
- Description copied from class:
OffHeapHashMap
- Associates the specified value with the specified key in this map. If the
map does not contain a mapping for the key, the new mapping is only
installed if there is room. If the map previously contained a mapping for
the key, the old value is replaced by the specified value even if this
results in a failure or eviction.
- Specified by:
fill in interface Segment<K,V>- Overrides:
fill in class OffHeapHashMap<K,V>
- Parameters:
key - key with which the specified value is to be associatedvalue - value to be associated with the specified key
- Returns:
- the previous value associated with key, or
null if there was no mapping for key
(irrespective of whether the value was successfully installed).
fill
public V fill(K key,
V value,
int metadata)
- Specified by:
fill in interface Segment<K,V>- Overrides:
fill in class OffHeapHashMap<K,V>
remove
public V remove(Object key)
- Specified by:
remove in interface Map<K,V>- Overrides:
remove in class OffHeapHashMap<K,V>
removeNoReturn
public boolean removeNoReturn(Object key)
- Specified by:
removeNoReturn in interface Segment<K,V>- Overrides:
removeNoReturn in class OffHeapHashMap<K,V>
clear
public void clear()
- Specified by:
clear in interface Map<K,V>- Overrides:
clear in class OffHeapHashMap<K,V>
putIfAbsent
public V putIfAbsent(K key,
V value)
- Specified by:
putIfAbsent in interface ConcurrentMap<K,V>
remove
public boolean remove(Object key,
Object value)
- Specified by:
remove in interface ConcurrentMap<K,V>
replace
public boolean replace(K key,
V oldValue,
V newValue)
- Specified by:
replace in interface ConcurrentMap<K,V>
replace
public V replace(K key,
V value)
- Specified by:
replace in interface ConcurrentMap<K,V>
getMetadata
public Integer getMetadata(Object key,
int mask)
- Specified by:
getMetadata in interface Segment<K,V>- Overrides:
getMetadata in class OffHeapHashMap<K,V>
getAndSetMetadata
public Integer getAndSetMetadata(Object key,
int mask,
int values)
- Specified by:
getAndSetMetadata in interface Segment<K,V>- Overrides:
getAndSetMetadata in class OffHeapHashMap<K,V>
getValueAndSetMetadata
public V getValueAndSetMetadata(Object key,
int mask,
int values)
- Specified by:
getValueAndSetMetadata in interface Segment<K,V>- Overrides:
getValueAndSetMetadata in class OffHeapHashMap<K,V>
removeMapping
protected boolean removeMapping(Object o)
- Overrides:
removeMapping in class OffHeapHashMap<K,V>
evict
public boolean evict(int index,
boolean shrink)
- Specified by:
evict in interface StorageEngine.Owner- Overrides:
evict in class OffHeapHashMap<K,V>
entrySet
public Set<Map.Entry<K,V>> entrySet()
- Specified by:
entrySet in interface Map<K,V>- Overrides:
entrySet in class OffHeapHashMap<K,V>
keySet
public Set<K> keySet()
- Specified by:
keySet in interface Map<K,V>- Overrides:
keySet in class OffHeapHashMap<K,V>
values
public Collection<V> values()
- Specified by:
values in interface Map<K,V>- Overrides:
values in class AbstractMap<K,V>
destroy
public void destroy()
- Specified by:
destroy in interface Segment<K,V>- Overrides:
destroy in class OffHeapHashMap<K,V>
shrink
public boolean shrink()
- Specified by:
shrink in interface Segment<K,V>
readLock
public abstract Lock readLock()
- Specified by:
readLock in interface ReadWriteLock- Overrides:
readLock in class OffHeapHashMap<K,V>
writeLock
public abstract Lock writeLock()
- Specified by:
writeLock in interface ReadWriteLock- Overrides:
writeLock in class OffHeapHashMap<K,V>
Copyright © 2015. All Rights Reserved.