Class ByteBufferPool.Bucket

  • Enclosing interface:
    ByteBufferPool

    public static class ByteBufferPool.Bucket
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int _capacity  
      private java.util.concurrent.atomic.AtomicLong _lastUpdate  
      private int _maxSize  
      private ByteBufferPool _pool  
      private java.util.Queue<java.nio.ByteBuffer> _queue  
      private java.util.concurrent.atomic.AtomicInteger _size  
    • Constructor Summary

      Constructors 
      Constructor Description
      Bucket​(ByteBufferPool pool, int capacity, int maxSize)  
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      java.nio.ByteBuffer acquire()  
      java.nio.ByteBuffer acquire​(boolean direct)
      Deprecated.
      use acquire() instead
      void clear()  
      (package private) void clear​(java.util.function.Consumer<java.nio.ByteBuffer> memoryFn)  
      (package private) long getLastUpdate()  
      (package private) boolean isEmpty()  
      private void queueOffer​(java.nio.ByteBuffer buffer)  
      private java.nio.ByteBuffer queuePoll()  
      void release​(java.nio.ByteBuffer buffer)  
      (package private) int size()  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • _queue

        private final java.util.Queue<java.nio.ByteBuffer> _queue
      • _capacity

        private final int _capacity
      • _maxSize

        private final int _maxSize
      • _size

        private final java.util.concurrent.atomic.AtomicInteger _size
      • _lastUpdate

        private final java.util.concurrent.atomic.AtomicLong _lastUpdate
    • Constructor Detail

      • Bucket

        public Bucket​(ByteBufferPool pool,
                      int capacity,
                      int maxSize)
    • Method Detail

      • acquire

        public java.nio.ByteBuffer acquire()
      • acquire

        @Deprecated
        public java.nio.ByteBuffer acquire​(boolean direct)
        Deprecated.
        use acquire() instead
        Parameters:
        direct - whether to create a direct buffer when none is available
        Returns:
        a ByteBuffer
      • release

        public void release​(java.nio.ByteBuffer buffer)
      • clear

        public void clear()
      • clear

        void clear​(java.util.function.Consumer<java.nio.ByteBuffer> memoryFn)
      • queueOffer

        private void queueOffer​(java.nio.ByteBuffer buffer)
      • queuePoll

        private java.nio.ByteBuffer queuePoll()
      • isEmpty

        boolean isEmpty()
      • size

        int size()
      • getLastUpdate

        long getLastUpdate()
      • toString

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