Class ByteBufferManager

    • Field Detail

      • DEFAULT_DIRECT_BUFFER

        public static final boolean DEFAULT_DIRECT_BUFFER
        See Also:
        Constant Field Values
    • Constructor Detail

      • ByteBufferManager

        public ByteBufferManager​(int bufferSize)
      • ByteBufferManager

        public ByteBufferManager​(int bufferSize,
                                 boolean directBuffer)
    • Method Detail

      • prepareForRecycle

        public boolean prepareForRecycle​(ByteBuffer buf)
        Description copied from interface: ObjectManager
        Prepare an object to be reused by a different user. Implementations of this method must make sure that any data from previous users is cleared.
        Specified by:
        prepareForRecycle in interface ObjectManager<ByteBuffer>
        Parameters:
        buf - The object which must be prepared for reuse.
        Returns:
        true if this object can be reused, false otherwise (for example if the size of the offered buffer is too small). After returning false ObjectManager.release(Object) will be called.
      • canReuse

        public boolean canReuse​(ByteBuffer buf)
        Specified by:
        canReuse in interface ObjectManager<ByteBuffer>
        Parameters:
        buf - -
        Returns:
        true if this pooled object can be reused, false otherwise. Example: The pooled object is a database connection which might not be reusable because the connection was closed while being in the pool.