Package one.nio.mem
Class SharedMemoryMap<K,V>
java.lang.Object
one.nio.mem.OffheapMap<K,V>
one.nio.mem.SharedMemoryMap<K,V>
- All Implemented Interfaces:
OffheapMapMXBean,SharedMemoryMapMXBean
- Direct Known Subclasses:
SharedMemoryFixedMap,SharedMemoryLongMap,SharedMemoryStringMap
-
Nested Class Summary
Nested classes/interfaces inherited from class one.nio.mem.OffheapMap
OffheapMap.BasicCleanup, OffheapMap.Record<K,V>, OffheapMap.SamplingCleanup, OffheapMap.Visitor<K, V>, OffheapMap.WritableRecord<K, V>, OffheapMap.WritableVisitor<K, V> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected MallocMTprotected static final longprotected static final longprotected final Stringprotected static final longprotected static final longprotected static final longprotected static final intprotected final MappedFileprotected final Stringprotected Serializer<V> protected static final longprotected static final longprotected static final longprotected static final longprotected static final longprotected static final longFields inherited from class one.nio.mem.OffheapMap
byteArrayOffset, capacity, cleanupInterval, cleanupThread, cleanupThreshold, CONCURRENCY_LEVEL, count, expirations, HASH_OFFSET, HEADER_SIZE, locks, lockWaitTime, log, mapBase, maxSamples, MB, minTimeToLive, NEXT_OFFSET, TIME_OFFSET, timeToLive, unsafe -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedSharedMemoryMap(int capacity, String fileName, long fileSize) protectedSharedMemoryMap(int capacity, String fileName, long fileSize, long expirationTime) -
Method Summary
Modifier and TypeMethodDescriptionprotected longallocateEntry(K key, long hashCode, int size) protected voidprotected voidconvert(Serializer<V> oldSerializer, Serializer<V> newSerializer) protected voidcreateAllocator(long startAddress, long totalMemory) protected voiddestroyEntry(long entry) intprotected byte[]longprotected longgetHeader(long offset) longlongprotected intheaderSize(long entry) protected voidprotected booleanneedCleanup(long expirationTime) protected voidrelocate(long delta) protected voidsetCustomData(byte[] data) protected voidsetHeader(long offset, long value) voidsetSerializer(Class<V> valueType) voidsetSerializer(Serializer<V> serializer) protected voidsetValueAt(long entry, V value) protected intsizeOf(long entry) protected intprotected voidprotected VvalueAt(long entry) Methods inherited from class one.nio.mem.OffheapMap
bucketFor, clear, close, equalsAt, get, getCapacity, getCleanupInterval, getCleanupThreshold, getCount, getExpirations, getLockWaitTime, getMaxSamples, getMinTimeToLive, getTimeToLive, hashCode, isExpired, iterate, iterate, iterate, iterate, iterate, iterate, keyAt, lockFor, lockRecordForRead, lockRecordForRead, lockRecordForWrite, lockRecordForWrite, put, putIfAbsent, remove, removeExpired, reuseEntry, setCleanupInterval, setCleanupThreshold, setLockWaitTime, setMaxSamples, setMinTimeToLive, setTimeAt, setTimeAt, setTimeToLive, shouldCleanup, timeAt, touchMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface one.nio.mem.OffheapMapMXBean
getCapacity, getCleanupInterval, getCleanupThreshold, getCount, getExpirations, getLockWaitTime, getMaxSamples, getMinTimeToLive, getTimeToLive, setCleanupInterval, setCleanupThreshold, setLockWaitTime, setMaxSamples, setMinTimeToLive, setTimeToLive
-
Field Details
-
SIGNATURE_CLEAR
protected static final long SIGNATURE_CLEAR- See Also:
-
SIGNATURE_LEGACY
protected static final long SIGNATURE_LEGACY- See Also:
-
SIGNATURE_DIRTY
protected static final long SIGNATURE_DIRTY- See Also:
-
SIGNATURE_OFFSET
protected static final long SIGNATURE_OFFSET- See Also:
-
TIMESTAMP_OFFSET
protected static final long TIMESTAMP_OFFSET- See Also:
-
CAPACITY_OFFSET
protected static final long CAPACITY_OFFSET- See Also:
-
BASE_OFFSET
protected static final long BASE_OFFSET- See Also:
-
UID_OFFSET
protected static final long UID_OFFSET- See Also:
-
CUSTOM_SIZE_OFFSET
protected static final long CUSTOM_SIZE_OFFSET- See Also:
-
CUSTOM_DATA_OFFSET
protected static final long CUSTOM_DATA_OFFSET- See Also:
-
MAP_OFFSET
protected static final long MAP_OFFSET- See Also:
-
MAX_CUSTOM_DATA_SIZE
protected static final int MAX_CUSTOM_DATA_SIZE- See Also:
-
className
-
mmap
-
name
-
allocator
-
serializer
-
-
Constructor Details
-
SharedMemoryMap
- Throws:
IOException
-
SharedMemoryMap
protected SharedMemoryMap(int capacity, String fileName, long fileSize, long expirationTime) throws IOException - Throws:
IOException
-
-
Method Details
-
closeInternal
protected void closeInternal()- Overrides:
closeInternalin classOffheapMap<K,V>
-
needCleanup
protected boolean needCleanup(long expirationTime) -
relocate
protected void relocate(long delta) -
getHeader
protected long getHeader(long offset) -
setHeader
protected void setHeader(long offset, long value) -
getCustomData
protected byte[] getCustomData() -
setCustomData
protected void setCustomData(byte[] data) -
allocateEntry
- Specified by:
allocateEntryin classOffheapMap<K,V>
-
destroyEntry
protected void destroyEntry(long entry) - Specified by:
destroyEntryin classOffheapMap<K,V>
-
sizeOf
protected int sizeOf(long entry) - Specified by:
sizeOfin classOffheapMap<K,V>
-
valueAt
- Specified by:
valueAtin classOffheapMap<K,V>
-
setValueAt
- Specified by:
setValueAtin classOffheapMap<K,V>
-
sizeOf
- Specified by:
sizeOfin classOffheapMap<K,V>
-
headerSize
protected int headerSize(long entry) -
getTotalMemory
public long getTotalMemory()- Specified by:
getTotalMemoryin interfaceSharedMemoryMapMXBean
-
getFreeMemory
public long getFreeMemory()- Specified by:
getFreeMemoryin interfaceSharedMemoryMapMXBean
-
getUsedMemory
public long getUsedMemory()- Specified by:
getUsedMemoryin interfaceSharedMemoryMapMXBean
-
entriesToClean
public int entriesToClean()- Overrides:
entriesToCleanin classOffheapMap<K,V>
-
createAllocator
protected void createAllocator(long startAddress, long totalMemory) -
setSerializer
- Throws:
IOException
-
setSerializer
- Throws:
IOException
-
loadSchema
- Throws:
IOException
-
storeSchema
protected void storeSchema() -
convert
-