Class RecyclingByteBlockAllocator

    • Field Detail

      • freeByteBlocks

        private byte[][] freeByteBlocks
      • maxBufferedBlocks

        private final int maxBufferedBlocks
      • freeBlocks

        private int freeBlocks
      • bytesUsed

        private final Counter bytesUsed
      • DEFAULT_BUFFERED_BLOCKS

        public static final int DEFAULT_BUFFERED_BLOCKS
        See Also:
        Constant Field Values
    • Method Detail

      • numBufferedBlocks

        public int numBufferedBlocks()
        Returns:
        the number of currently buffered blocks
      • bytesUsed

        public long bytesUsed()
        Returns:
        the number of bytes currently allocated by this ByteBlockPool.Allocator
      • maxBufferedBlocks

        public int maxBufferedBlocks()
        Returns:
        the maximum number of buffered byte blocks
      • freeBlocks

        public int freeBlocks​(int num)
        Removes the given number of byte blocks from the buffer if possible.
        Parameters:
        num - the number of byte blocks to remove
        Returns:
        the number of actually removed buffers