Class DirectByteBufferPoolReal

    • Field Detail

      • disable_gc

        private static final boolean disable_gc
      • DEBUG_TRACK_HANDEDOUT

        protected static final boolean DEBUG_TRACK_HANDEDOUT
        See Also:
        Constant Field Values
      • DEBUG_HANDOUT_SIZES

        protected static final boolean DEBUG_HANDOUT_SIZES
        See Also:
        Constant Field Values
      • EXTRA_BUCKETS

        private static final int[] EXTRA_BUCKETS
      • MAX_SIZE

        public static final int MAX_SIZE
      • buffersMap

        private final java.util.Map buffersMap
      • poolsLock

        private final java.lang.Object poolsLock
      • SLICE_ALLOC_CHUNK_SIZE

        private static final int SLICE_ALLOC_CHUNK_SIZE
        See Also:
        Constant Field Values
      • SLICE_ENTRY_SIZES

        private static final short[] SLICE_ENTRY_SIZES
      • SLICE_ALLOC_MAXS

        private static final short[] SLICE_ALLOC_MAXS
      • SLICE_ENTRY_ALLOC_SIZES

        private static final short[] SLICE_ENTRY_ALLOC_SIZES
      • slice_entries

        private static final java.util.List[] slice_entries
      • slice_allocs

        private static final boolean[][] slice_allocs
      • slice_alloc_fails

        private static final boolean[] slice_alloc_fails
      • slice_use_count

        private static final long[] slice_use_count
      • handed_out

        private final java.util.Map handed_out
      • size_counts

        private final java.util.Map size_counts
      • COMPACTION_CHECK_PERIOD

        private static final long COMPACTION_CHECK_PERIOD
        See Also:
        Constant Field Values
      • bytesIn

        private long bytesIn
      • bytesOut

        private long bytesOut
    • Constructor Detail

      • DirectByteBufferPoolReal

        protected DirectByteBufferPoolReal()
    • Method Detail

      • allocateNewBuffer

        private java.nio.ByteBuffer allocateNewBuffer​(int _size)
        Allocate and return a new direct ByteBuffer.
      • getBufferSupport

        protected DirectByteBuffer getBufferSupport​(byte _allocator,
                                                    int _length)
        Retrieve a buffer from the buffer pool of size at least length, and no larger than DirectByteBufferPool.MAX_SIZE
        Specified by:
        getBufferSupport in class DirectByteBufferPool
      • getBufferHelper

        private DirectByteBuffer getBufferHelper​(byte _allocator,
                                                 int _length)
        Retrieve an appropriate buffer from the free pool, or create a new one if the pool is empty.
      • clearBufferPools

        private void clearBufferPools()
        Clears the free buffer pools so that currently unused buffers can be garbage collected.
      • runGarbageCollection

        private void runGarbageCollection()
        Force system garbage collection.
      • compactBuffers

        private void compactBuffers()
        Checks memory usage of free buffers in buffer pools, and calls the compaction method if necessary.
      • bytesFree

        private long bytesFree()
      • printInUse

        private void printInUse​(boolean verbose)
      • getSliceBuffer

        private DirectByteBuffer getSliceBuffer​(byte _allocator,
                                                int _length)
      • compactSlices

        private void compactSlices()
      • getSliceIndex

        private int getSliceIndex​(int _length)