- java.lang.Object
-
- com.sun.xml.ws.db.toplink.ObjectPool<T>
-
- Type Parameters:
T- the type of the object to pool
public abstract class ObjectPool<T> extends Object
Object pool allocator that leverages aConcurrentLinkedQueuefor synchronization.
-
-
Constructor Summary
Constructors Constructor Description ObjectPool()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Tallocate()Allocate an object from the pool or create a new one if we cannot get one from the queue.protected abstract TnewInstance()Subclasses must override the object creation method.voidreplace(T value)Return an object to the pool.
-
-
-
Method Detail
-
allocate
public final T allocate()
Allocate an object from the pool or create a new one if we cannot get one from the queue.- Returns:
- the queued or newly-created object
-
replace
public final void replace(T value)
Return an object to the pool.- Parameters:
value- the object being returned
-
newInstance
protected abstract T newInstance()
Subclasses must override the object creation method.- Returns:
- a new instance of the object.
-
-