org.terracotta.offheapstore
Class WriteLockedOffHeapHashMap<K,V>

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by org.terracotta.offheapstore.OffHeapHashMap<K,V>
          extended by org.terracotta.offheapstore.AbstractLockedOffHeapHashMap<K,V>
              extended by org.terracotta.offheapstore.WriteLockedOffHeapHashMap<K,V>
Type Parameters:
K - the type of keys maintained by this map
V - the type of mapped values
All Implemented Interfaces:
ConcurrentMap<K,V>, ReadWriteLock, Map<K,V>, MapInternals, Segment<K,V>, StorageEngine.Owner

public class WriteLockedOffHeapHashMap<K,V>
extends AbstractLockedOffHeapHashMap<K,V>

An exclusive-read/write off-heap hash-map.

This map uses a regular ReentrantLock to provide exclusive read and write operations.

Author:
Chris Dennis

Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Field Summary
 
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
WriteLockedOffHeapHashMap(PageSource tableSource, StorageEngine<? super K,? super V> storageEngine)
           
WriteLockedOffHeapHashMap(PageSource tableSource, StorageEngine<? super K,? super V> storageEngine, int tableSize)
           
 
Method Summary
 ReentrantReadWriteLock getLock()
          Return the ReentrantReadWriteLock used by this segment.
 Lock readLock()
           
 Lock writeLock()
           
 
Methods inherited from class org.terracotta.offheapstore.AbstractLockedOffHeapHashMap
clear, containsKey, destroy, entrySet, evict, fill, fill, get, getAndSetMetadata, getEncodingForHashAndBinary, installMappingForHashAndEncoding, keySet, put, put, putIfAbsent, remove, remove, removeMapping, removeNoReturn, replace, replace, setMetadata, shrink, size, values
 
Methods inherited from class org.terracotta.offheapstore.OffHeapHashMap
added, encodingSet, fill, getAllocatedMemory, getAtTableOffset, getDataAllocatedMemory, getDataOccupiedMemory, getDataSize, getDataVitalMemory, getEntryAtTableOffset, getMetadata, getOccupiedMemory, getRemovedSlotCount, getReprobeLength, getSize, getSlotForHashAndEncoding, getStorageEngine, getTableCapacity, getUsedSlotCount, getVitalMemory, hit, isAvailable, isPresent, isRemoved, isTerminating, isThiefForTableAllocations, removeAtTableOffset, removed, spread, storageEngineFailure, tableExpansionFailure, tryIncreaseReprobe, updated, updateEncoding, updateMetadata
 
Methods inherited from class java.util.AbstractMap
clone, containsValue, equals, hashCode, isEmpty, putAll, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
containsValue, equals, hashCode, isEmpty, putAll
 
Methods inherited from interface org.terracotta.offheapstore.MapInternals
getAllocatedMemory, getDataAllocatedMemory, getDataOccupiedMemory, getDataSize, getDataVitalMemory, getOccupiedMemory, getRemovedSlotCount, getReprobeLength, getSize, getTableCapacity, getUsedSlotCount, getVitalMemory
 

Constructor Detail

WriteLockedOffHeapHashMap

public WriteLockedOffHeapHashMap(PageSource tableSource,
                                 StorageEngine<? super K,? super V> storageEngine)

WriteLockedOffHeapHashMap

public WriteLockedOffHeapHashMap(PageSource tableSource,
                                 StorageEngine<? super K,? super V> storageEngine,
                                 int tableSize)
Method Detail

readLock

public Lock readLock()
Specified by:
readLock in interface ReadWriteLock
Specified by:
readLock in class AbstractLockedOffHeapHashMap<K,V>

writeLock

public Lock writeLock()
Specified by:
writeLock in interface ReadWriteLock
Specified by:
writeLock in class AbstractLockedOffHeapHashMap<K,V>

getLock

public ReentrantReadWriteLock getLock()
Description copied from interface: Segment
Return the ReentrantReadWriteLock used by this segment.

Returns:
RRWL for this segment


Copyright © 2015. All Rights Reserved.