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

public abstract class SharedMemoryMap<K,V> extends OffheapMap<K,V> implements SharedMemoryMapMXBean
  • Field Details

  • Constructor Details

    • SharedMemoryMap

      protected SharedMemoryMap(int capacity, String fileName, long fileSize) throws IOException
      Throws:
      IOException
    • SharedMemoryMap

      protected SharedMemoryMap(int capacity, String fileName, long fileSize, long expirationTime) throws IOException
      Throws:
      IOException
  • Method Details

    • closeInternal

      protected void closeInternal()
      Overrides:
      closeInternal in class OffheapMap<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

      protected long allocateEntry(K key, long hashCode, int size)
      Specified by:
      allocateEntry in class OffheapMap<K,V>
    • destroyEntry

      protected void destroyEntry(long entry)
      Specified by:
      destroyEntry in class OffheapMap<K,V>
    • sizeOf

      protected int sizeOf(long entry)
      Specified by:
      sizeOf in class OffheapMap<K,V>
    • valueAt

      protected V valueAt(long entry)
      Specified by:
      valueAt in class OffheapMap<K,V>
    • setValueAt

      protected void setValueAt(long entry, V value)
      Specified by:
      setValueAt in class OffheapMap<K,V>
    • sizeOf

      protected int sizeOf(V value)
      Specified by:
      sizeOf in class OffheapMap<K,V>
    • headerSize

      protected int headerSize(long entry)
    • getTotalMemory

      public long getTotalMemory()
      Specified by:
      getTotalMemory in interface SharedMemoryMapMXBean
    • getFreeMemory

      public long getFreeMemory()
      Specified by:
      getFreeMemory in interface SharedMemoryMapMXBean
    • getUsedMemory

      public long getUsedMemory()
      Specified by:
      getUsedMemory in interface SharedMemoryMapMXBean
    • entriesToClean

      public int entriesToClean()
      Overrides:
      entriesToClean in class OffheapMap<K,V>
    • createAllocator

      protected void createAllocator(long startAddress, long totalMemory)
    • setSerializer

      public void setSerializer(Class<V> valueType) throws IOException
      Throws:
      IOException
    • setSerializer

      public void setSerializer(Serializer<V> serializer) throws IOException
      Throws:
      IOException
    • loadSchema

      protected void loadSchema() throws IOException
      Throws:
      IOException
    • storeSchema

      protected void storeSchema()
    • convert

      protected void convert(Serializer<V> oldSerializer, Serializer<V> newSerializer)