java.io.Closeable, java.lang.AutoCloseablepublic class BufferPool
extends java.lang.Object
implements java.io.Closeable
ByteBuffer instances.
Avoids creating a new buffer if a previously created buffer is already available.
| Constructor | Description |
|---|---|
BufferPool(int size,
int bufferSize,
PrefetchingStatistics prefetchingStatistics) |
Initializes a new instance of the
BufferPool class. |
| Modifier and Type | Method | Description |
|---|---|---|
BufferData |
acquire(int blockNumber) |
Acquires a
ByteBuffer; blocking if necessary until one becomes available. |
void |
close() |
|
java.util.List<BufferData> |
getAll() |
Gets a list of all blocks in this pool.
|
int |
numAvailable() |
|
int |
numCreated() |
|
void |
release(BufferData data) |
Releases a previously acquired resource.
|
java.lang.String |
toString() |
|
BufferData |
tryAcquire(int blockNumber) |
Acquires a buffer if one is immediately available.
|
public BufferPool(int size,
int bufferSize,
PrefetchingStatistics prefetchingStatistics)
BufferPool class.size - number of buffer in this pool.bufferSize - size in bytes of each buffer.prefetchingStatistics - statistics for this stream.java.lang.IllegalArgumentException - if size is zero or negative.java.lang.IllegalArgumentException - if bufferSize is zero or negative.public java.util.List<BufferData> getAll()
public BufferData acquire(int blockNumber)
ByteBuffer; blocking if necessary until one becomes available.blockNumber - the id of the block to acquire.BufferData.public BufferData tryAcquire(int blockNumber)
blockNumber - the id of the block to try acquire.BufferData or null.public void release(BufferData data)
data - the BufferData instance to release.java.lang.IllegalArgumentException - if data is null.java.lang.IllegalArgumentException - if data cannot be released due to its state.public void close()
close in interface java.lang.AutoCloseableclose in interface java.io.Closeablepublic java.lang.String toString()
toString in class java.lang.Objectpublic int numCreated()
public int numAvailable()
Copyright © 2008–2025 Apache Software Foundation. All rights reserved.