Class VectorIOBufferPool

java.lang.Object
org.apache.hadoop.fs.impl.VectorIOBufferPool
All Implemented Interfaces:
ByteBufferPool

public final class VectorIOBufferPool extends Object implements ByteBufferPool
A ByteBufferPool implementation that uses a pair of functions to allocate and release ByteBuffers; intended for use implementing the VectorIO API as it makes the pair of functions easier to pass around and use in existing code.

No matter what kind of buffer is requested, the allocation function is invoked; that is: the direct flag is ignored.

  • Constructor Details

    • VectorIOBufferPool

      public VectorIOBufferPool(IntFunction<ByteBuffer> allocate, Consumer<ByteBuffer> release)
      Parameters:
      allocate - function to allocate ByteBuffer
      release - callable to release a ByteBuffer.
  • Method Details

    • getBuffer

      public ByteBuffer getBuffer(boolean direct, int length)
      Get a ByteBuffer.
      Specified by:
      getBuffer in interface ByteBufferPool
      Parameters:
      direct - heap/direct flag. Unused.
      length - The minimum length the buffer will have.
      Returns:
      a buffer
    • putBuffer

      public void putBuffer(ByteBuffer buffer)
      Release a buffer. Unlike normal ByteBufferPool implementations a null buffer is accepted and ignored.
      Specified by:
      putBuffer in interface ByteBufferPool
      Parameters:
      buffer - buffer to release; may be null.