ch.bind.philib.pool
Interface Pool<T>

Type Parameters:
T - The type of object which are managed by this pool.
All Known Implementing Classes:
ByteArrayPool, ByteBufferPool, ConcurrentPool, PoolBase, SoftRefPool, StrongRefPool

public interface Pool<T>

The base interface for object pools.

Author:
Philipp Meinen

Method Summary
 void clear()
          instructs the pool to destroy all pooled objects.
 int getNumPooled()
           
 PoolStats getPoolStats()
           
 void recycle(T value)
          Recycles an object which might be reused.
 T take()
          Take an object from the object-pool.
 

Method Detail

take

T take()
Take an object from the object-pool.

Returns:
A free and usable object from the pool if one exists. Otherwise a new object is created from the underlying manager.

recycle

void recycle(T value)
Recycles an object which might be reused. The caller must not use this object after calling this method.

Parameters:
value - The object to be recycled.

getPoolStats

PoolStats getPoolStats()
Returns:
This pool's statistics object. Calls to this pool's methods are visible to successive calls to this statics-object's methods.

getNumPooled

int getNumPooled()
Returns:
The number of currently pooled objects.

clear

void clear()
instructs the pool to destroy all pooled objects.



Copyright © 2013. All Rights Reserved.