ch.bind.philib.pool.manager
Class ByteArrayManager

java.lang.Object
  extended by ch.bind.philib.pool.manager.ByteArrayManager
All Implemented Interfaces:
ObjectManager<byte[]>

public final class ByteArrayManager
extends Object
implements ObjectManager<byte[]>


Constructor Summary
ByteArrayManager(int bufferSize)
           
 
Method Summary
 boolean canReuse(byte[] buf)
           
 byte[] create()
           
 boolean prepareForRecycle(byte[] buf)
          Prepare an object to be reused by a different user.
 void release(byte[] buf)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByteArrayManager

public ByteArrayManager(int bufferSize)
Method Detail

create

public byte[] create()
Specified by:
create in interface ObjectManager<byte[]>

prepareForRecycle

public boolean prepareForRecycle(byte[] buf)
Description copied from interface: ObjectManager
Prepare an object to be reused by a different user. Implementors of this method must make sure that any data from previous users is cleared.

Specified by:
prepareForRecycle in interface ObjectManager<byte[]>
Parameters:
buf - The object which must be prepared for reuse.
Returns:
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.

release

public void release(byte[] buf)
Specified by:
release in interface ObjectManager<byte[]>

canReuse

public boolean canReuse(byte[] buf)
Specified by:
canReuse in interface ObjectManager<byte[]>
Parameters:
buf - -
Returns:
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.