ch.bind.philib.pool.buffer
Class ByteArrayPool

java.lang.Object
  extended by ch.bind.philib.pool.buffer.ByteArrayPool
All Implemented Interfaces:
Pool<byte[]>

public final class ByteArrayPool
extends Object
implements Pool<byte[]>

TODO

Author:
Philipp Meinen

Constructor Summary
ByteArrayPool(Pool<byte[]> backend)
           
 
Method Summary
 void clear()
          instructs the pool to destroy all pooled objects.
static ByteArrayPool create(int bufferSize, int maxEntries)
           
static ByteArrayPool create(int bufferSize, int maxEntries, int concurrencyLevel)
           
 int getNumPooled()
           
 PoolStats getPoolStats()
           
 void recycle(byte[] value)
          Recycles an object which might be reused.
 byte[] take()
          Take an object from the object-pool.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByteArrayPool

public ByteArrayPool(Pool<byte[]> backend)
Method Detail

take

public final byte[] take()
Description copied from interface: Pool
Take an object from the object-pool.

Specified by:
take in interface Pool<byte[]>
Returns:
A free and usable object from the pool if one exists. Otherwise a new object is created from the underlying manager.

recycle

public final void recycle(byte[] value)
Description copied from interface: Pool
Recycles an object which might be reused. The caller must not use this object after calling this method.

Specified by:
recycle in interface Pool<byte[]>
Parameters:
value - The object to be recycled.

getPoolStats

public final PoolStats getPoolStats()
Specified by:
getPoolStats in interface Pool<byte[]>
Returns:
This pool's statistics object. Calls to this pool's methods are visible to successive calls to this statics-object's methods.

getNumPooled

public int getNumPooled()
Specified by:
getNumPooled in interface Pool<byte[]>
Returns:
The number of currently pooled objects.

clear

public void clear()
Description copied from interface: Pool
instructs the pool to destroy all pooled objects.

Specified by:
clear in interface Pool<byte[]>

create

public static ByteArrayPool create(int bufferSize,
                                   int maxEntries)

create

public static ByteArrayPool create(int bufferSize,
                                   int maxEntries,
                                   int concurrencyLevel)


Copyright © 2013. All Rights Reserved.