Package org.apache.hadoop.fs.impl
Class VectorIOBufferPool
java.lang.Object
org.apache.hadoop.fs.impl.VectorIOBufferPool
- All Implemented Interfaces:
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 Summary
ConstructorsConstructorDescriptionVectorIOBufferPool(IntFunction<ByteBuffer> allocate, Consumer<ByteBuffer> release) -
Method Summary
Modifier and TypeMethodDescriptiongetBuffer(boolean direct, int length) Get a ByteBuffer.voidputBuffer(ByteBuffer buffer) Release a buffer.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.hadoop.io.ByteBufferPool
release
-
Constructor Details
-
VectorIOBufferPool
- Parameters:
allocate- function to allocate ByteBufferrelease- callable to release a ByteBuffer.
-
-
Method Details
-
getBuffer
Get a ByteBuffer.- Specified by:
getBufferin interfaceByteBufferPool- Parameters:
direct- heap/direct flag. Unused.length- The minimum length the buffer will have.- Returns:
- a buffer
-
putBuffer
Release a buffer. Unlike normal ByteBufferPool implementations a null buffer is accepted and ignored.- Specified by:
putBufferin interfaceByteBufferPool- Parameters:
buffer- buffer to release; may be null.
-