|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.xml.ws.util.Pool<T>
public abstract class Pool<T>
General-purpose object pool.
In many parts of the runtime, we need to pool instances of objects that
are expensive to create (such as JAXB objects, StAX parsers, Tube
instances.)
This class provides a default implementation of such a pool. TODO: improve the implementation
Nested Class Summary | |
---|---|
static class |
Pool.Marshaller
JAXB Marshaller pool. |
static class |
Pool.TubePool
Tube pool. |
static class |
Pool.Unmarshaller
JAXB Marshaller pool. |
Constructor Summary | |
---|---|
Pool()
|
Method Summary | |
---|---|
protected abstract T |
create()
Creates a new instance of object. |
void |
recycle(T t)
Returns an object back to the pool. |
T |
take()
Gets a new object from the pool. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Pool()
Method Detail |
---|
public final T take()
If no object is available in the pool, this method creates a new one.
public final void recycle(T t)
protected abstract T create()
This method is used when someone wants to
take
an object from an empty pool.
Also note that multiple threads may call this method concurrently.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |