public final class BufferPool extends Object
| Modifier and Type | Method and Description |
|---|---|
ByteBufferWrapper |
getBuffer(int bufferSize)
Obtain a buffer from this buffer pool through the method.
|
static BufferPool |
getInstance()
Use this method to get the instance of BufferPool.
|
void |
initialize(org.apache.hadoop.conf.Configuration conf)
Create buffers correctly by reading the buffer file directory,
buffer pool size,and file block size in the configuration.
|
void |
returnBuffer(ByteBufferWrapper byteBufferWrapper)
return the byte buffer wrapper to the buffer pool.
|
public static BufferPool getInstance()
public void initialize(org.apache.hadoop.conf.Configuration conf)
throws IOException
conf - Provides configurations for the Hadoop runtimeIOException - Configuration errors,
insufficient or no access for memory or
disk space may cause this exceptionpublic ByteBufferWrapper getBuffer(int bufferSize) throws IOException
bufferSize - expected buffer size to getIOException - if the buffer pool not initialized,
or the bufferSize parameter is not within
the range[1MB to the single buffer size]public void returnBuffer(ByteBufferWrapper byteBufferWrapper) throws InterruptedException, IOException
byteBufferWrapper - the byte buffer wrapper getting from the poolInterruptedException - if interrupted while waitingIOException - some io error occursCopyright © 2008–2021 Apache Software Foundation. All rights reserved.