ch.bind.philib.pool.manager
public final class ByteBufferManager extends Object implements ObjectManager<ByteBuffer>
| Modifier and Type | Field and Description |
|---|---|
static boolean |
DEFAULT_DIRECT_BUFFER |
| Constructor and Description |
|---|
ByteBufferManager(int bufferSize) |
ByteBufferManager(int bufferSize,
boolean directBuffer) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canReuse(ByteBuffer buf) |
ByteBuffer |
create() |
boolean |
prepareForRecycle(ByteBuffer buf)
Prepare an object to be reused by a different user.
|
void |
release(ByteBuffer buf) |
public static final boolean DEFAULT_DIRECT_BUFFER
public ByteBufferManager(int bufferSize)
public ByteBufferManager(int bufferSize,
boolean directBuffer)
public ByteBuffer create()
create in interface ObjectManager<ByteBuffer>public boolean prepareForRecycle(ByteBuffer buf)
ObjectManagerprepareForRecycle in interface ObjectManager<ByteBuffer>buf - The object which must be prepared for reuse.true if this object can be reused, false otherwise (for example if the size of the
offered buffer is too small). After returning false destroy(T) will be called.public void release(ByteBuffer buf)
release in interface ObjectManager<ByteBuffer>public boolean canReuse(ByteBuffer buf)
canReuse in interface ObjectManager<ByteBuffer>buf - -true if this pooled object can be reused, false otherwise. Example: The pooled object is
a database connection which might not be reusable because the connection was closed while being in the
pool.Copyright © 2013. All Rights Reserved.