public final class BufferPool
extends java.lang.Object
| Modifier and Type | Method | 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 java.io.IOException
conf - Provides configurations for the Hadoop runtimejava.io.IOException - Configuration errors,
insufficient or no access for memory or
disk space may cause this exceptionpublic ByteBufferWrapper getBuffer(int bufferSize) throws java.io.IOException
bufferSize - expected buffer size to getjava.io.IOException - 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 java.lang.InterruptedException, java.io.IOException
byteBufferWrapper - the byte buffer wrapper getting from the pooljava.lang.InterruptedException - if interrupted while waitingjava.io.IOException - some io error occursCopyright © 2008–2025 Apache Software Foundation. All rights reserved.