Package com.sun.xml.ws.util
Class Pool<T>
java.lang.Object
com.sun.xml.ws.util.Pool<T>
- Direct Known Subclasses:
Pool.Marshaller,Pool.TubePool,Pool.Unmarshaller
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
- Author:
- Kohsuke Kawaguchi
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classJAXBMarshallerpool.static final classTubepool.static final classJAXBMarshallerpool. -
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Pool
public Pool()
-
-
Method Details
-
take
Gets a new object from the pool.If no object is available in the pool, this method creates a new one.
- Returns:
- always non-null.
-
recycle
Returns an object back to the pool. -
create
Creates a new instance of object.This method is used when someone wants to
takean object from an empty pool.Also note that multiple threads may call this method concurrently.
-