- java.lang.Object
-
- ch.bind.philib.pool.buffer.ByteBufferPool
-
- All Implemented Interfaces:
Pool<ByteBuffer>
public final class ByteBufferPool extends Object implements Pool<ByteBuffer>
- Author:
- Philipp Meinen
-
-
Constructor Summary
Constructors Constructor Description ByteBufferPool(Pool<ByteBuffer> backend)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()instructs the pool to destroy all pooled objects.static ByteBufferPoolcreate(int bufferSize, int maxEntries)static ByteBufferPoolcreate(int bufferSize, int maxEntries, int concurrencyLevel)intgetNumPooled()PoolStatsgetPoolStats()voidrecycle(ByteBuffer value)Recycles an object which might be reused.ByteBuffertake()Take an object from the object-pool.
-
-
-
Constructor Detail
-
ByteBufferPool
public ByteBufferPool(Pool<ByteBuffer> backend)
-
-
Method Detail
-
take
public final ByteBuffer take()
Description copied from interface:PoolTake an object from the object-pool.- Specified by:
takein interfacePool<ByteBuffer>- 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(ByteBuffer value)
Description copied from interface:PoolRecycles an object which might be reused. The caller must not use this object after calling this method.- Specified by:
recyclein interfacePool<ByteBuffer>- Parameters:
value- The object to be recycled.
-
getPoolStats
public final PoolStats getPoolStats()
- Specified by:
getPoolStatsin interfacePool<ByteBuffer>- 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:
getNumPooledin interfacePool<ByteBuffer>- Returns:
- The number of currently pooled objects.
-
clear
public void clear()
Description copied from interface:Poolinstructs the pool to destroy all pooled objects.- Specified by:
clearin interfacePool<ByteBuffer>
-
create
public static ByteBufferPool create(int bufferSize, int maxEntries)
-
create
public static ByteBufferPool create(int bufferSize, int maxEntries, int concurrencyLevel)
-
-