- java.lang.Object
-
- ch.bind.philib.pool.manager.ByteArrayManager
-
- All Implemented Interfaces:
ObjectManager<byte[]>
public final class ByteArrayManager extends Object implements ObjectManager<byte[]>
-
-
Constructor Summary
Constructors Constructor Description ByteArrayManager(int bufferSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanReuse(byte[] buf)byte[]create()booleanprepareForRecycle(byte[] buf)Prepare an object to be reused by a different user.voidrelease(byte[] buf)
-
-
-
Method Detail
-
create
public byte[] create()
- Specified by:
createin interfaceObjectManager<byte[]>
-
prepareForRecycle
public boolean prepareForRecycle(byte[] buf)
Description copied from interface:ObjectManagerPrepare an object to be reused by a different user. Implementations of this method must make sure that any data from previous users is cleared.- Specified by:
prepareForRecyclein interfaceObjectManager<byte[]>- Parameters:
buf- The object which must be prepared for reuse.- Returns:
trueif this object can be reused,falseotherwise (for example if the size of the offered buffer is too small). After returningfalseObjectManager.release(Object)will be called.
-
release
public void release(byte[] buf)
- Specified by:
releasein interfaceObjectManager<byte[]>
-
canReuse
public boolean canReuse(byte[] buf)
- Specified by:
canReusein interfaceObjectManager<byte[]>- Parameters:
buf- -- Returns:
trueif this pooled object can be reused,falseotherwise. Example: The pooled object is a database connection which might not be reusable because the connection was closed while being in the pool.
-
-