ch.bind.philib.pool.object
Class PoolBase<T>

java.lang.Object
  extended by ch.bind.philib.pool.object.PoolBase<T>
All Implemented Interfaces:
Pool<T>
Direct Known Subclasses:
SoftRefPool, StrongRefPool

public abstract class PoolBase<T>
extends Object
implements Pool<T>

Author:
Philipp Meinen

Constructor Summary
PoolBase(ObjectManager<T> manager)
           
 
Method Summary
 void clear()
          instructs the pool to destroy all pooled objects.
 PoolStats getPoolStats()
           
protected abstract  boolean offer(T value)
           
protected abstract  T poll()
           
 void recycle(T value)
          Recycles an object which might be reused.
 T 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
 
Methods inherited from interface ch.bind.philib.pool.Pool
getNumPooled
 

Constructor Detail

PoolBase

public PoolBase(ObjectManager<T> manager)
Method Detail

take

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

Specified by:
take in interface Pool<T>
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(T 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<T>
Parameters:
value - The object to be recycled.

clear

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

Specified by:
clear in interface Pool<T>

getPoolStats

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

poll

protected abstract T poll()

offer

protected abstract boolean offer(T value)


Copyright © 2013. All Rights Reserved.