-
- 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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclear()instructs the pool to destroy all pooled objects.intgetNumPooled()PoolStatsgetPoolStats()voidrecycle(T value)Recycles an object which might be reused.Ttake()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.
-
-