Class OffHeapStorageArea


  • public class OffHeapStorageArea
    extends java.lang.Object
    • Field Detail

      • LOGGER

        private static final org.slf4j.Logger LOGGER
      • VALIDATING

        private static final boolean VALIDATING
      • LARGEST_POWER_OF_TWO

        private static final long LARGEST_POWER_OF_TWO
      • EMPTY_BUFFER_ARRAY

        private static final java.nio.ByteBuffer[] EMPTY_BUFFER_ARRAY
      • initialPageSize

        private final int initialPageSize
      • maximalPageSize

        private final int maximalPageSize
      • pageGrowthAreaSize

        private final int pageGrowthAreaSize
      • compressThreshold

        private final float compressThreshold
      • allocator

        private final Allocator allocator
      • random

        private final java.util.Random random
      • released

        private java.util.Deque<java.util.Collection<Page>> released
      • pages

        private final java.util.Map<java.lang.Integer,​Page> pages
      • thief

        private final boolean thief
      • victim

        private final boolean victim
    • Method Detail

      • clear

        public void clear()
      • readByte

        public byte readByte​(long address)
      • readShort

        public short readShort​(long address)
      • readInt

        public int readInt​(long address)
      • readLong

        public long readLong​(long address)
      • readBuffer

        public java.nio.ByteBuffer readBuffer​(long address,
                                              int length)
        Read the given range and return the data as a single read-only ByteBuffer.
        Parameters:
        address - address to read from
        length - number of bytes to read
        Returns:
        a read-only buffer
      • readBuffers

        public java.nio.ByteBuffer[] readBuffers​(long address,
                                                 int length)
        Read the given range and return the data as an array of read-only ByteBuffers.
        Parameters:
        address - address to read from
        length - number of bytes to read
        Returns:
        an array of read-only buffers
      • writeByte

        public void writeByte​(long address,
                              byte value)
      • writeShort

        public void writeShort​(long address,
                               short value)
      • writeInt

        public void writeInt​(long address,
                             int value)
      • writeLong

        public void writeLong​(long address,
                              long value)
      • writeBuffer

        public void writeBuffer​(long address,
                                java.nio.ByteBuffer data)
      • writeBuffers

        public void writeBuffers​(long address,
                                 java.nio.ByteBuffer[] data)
      • free

        public void free​(long address)
      • compress

        private boolean compress()
      • destroy

        public void destroy()
      • allocate

        public long allocate​(long size)
      • expandData

        private boolean expandData()
      • getAllocatedMemory

        public long getAllocatedMemory()
      • getOccupiedMemory

        public long getOccupiedMemory()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • pageIndexFor

        private int pageIndexFor​(long address)
      • addressForPage

        private long addressForPage​(int index)
      • pageAddressFor

        private int pageAddressFor​(long address)
      • pageSizeFor

        private int pageSizeFor​(int index)
      • nextPageSize

        private int nextPageSize()
      • validateStorageArea

        public void validateStorageArea()
      • release

        public void release​(long address)
      • freePage

        private void freePage​(Page p)
      • release

        public java.util.Collection<Page> release​(java.util.Collection<Page> targets)
      • moveAddressDown

        private boolean moveAddressDown​(long target)
      • moveAddressDown

        private boolean moveAddressDown​(long target,
                                        int size,
                                        long start)
      • shrink

        public boolean shrink()
      • getIndexForPage

        private int getIndexForPage​(Page p)
      • validatePages

        private void validatePages()