Package org.apache.xml.security.utils
Class WeakObjectPool<T,E extends Throwable>
java.lang.Object
org.apache.xml.security.utils.WeakObjectPool<T,E>
Deprecated.
This class is no longer in use in Santuario 2.1.4
Abstract base class for pooling objects. The two public methods are
getObject()
and (repool(Object)
. Objects are held through
weak references so even objects that are not repooled are subject to garbage collection.
Subclasses must implement the abstract createObject()
.
Internally, the pool is stored in a java.util.concurrent.LinkedBlockingDeque instance.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract T
Deprecated.Called whenever a new pool object is desired; subclasses must implement.Deprecated.Subclasses can subclass to return a more specific type.boolean
Deprecated.Adds the given object to the pool, provided that the object was created by this pool.
-
Constructor Details
-
WeakObjectPool
protected WeakObjectPool()Deprecated.The lone constructor.
-
-
Method Details
-
createObject
Deprecated.Called whenever a new pool object is desired; subclasses must implement.- Returns:
- object of the type desired by the subclass
- Throws:
E
- Throwable's subclass
-
getObject
Deprecated.Subclasses can subclass to return a more specific type.- Returns:
- an object from the pool; will block until an object is available
- Throws:
E
-
repool
Deprecated.Adds the given object to the pool, provided that the object was created by this pool.- Parameters:
obj
- the object to return to the pool- Returns:
- whether the object was successfully added as available
-