Package org.apache.xml.security.utils
Class WeakObjectPool<T,E extends java.lang.Throwable>
- java.lang.Object
-
- org.apache.xml.security.utils.WeakObjectPool<T,E>
-
@Deprecated public abstract class WeakObjectPool<T,E extends java.lang.Throwable> extends java.lang.Object
Deprecated.This class is no longer in use in Santuario 2.1.4Abstract base class for pooling objects. The two public methods aregetObject()
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 abstractcreateObject()
.Internally, the pool is stored in a java.util.concurrent.LinkedBlockingDeque instance.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.concurrent.BlockingQueue<java.lang.ref.WeakReference<T>>
available
Deprecated.created, available objects to be checked out to clientsprivate static java.lang.Integer
MARKER_VALUE
Deprecated.private java.util.Map<T,java.lang.Integer>
onLoan
Deprecated.Synchronized, identity map of loaned out objects (WeakHashMap); use to ensure we repool only object originating from here and do it once.
-
Constructor Summary
Constructors Modifier Constructor Description protected
WeakObjectPool()
Deprecated.The lone constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected abstract T
createObject()
Deprecated.Called whenever a new pool object is desired; subclasses must implement.T
getObject()
Deprecated.Subclasses can subclass to return a more specific type.boolean
repool(T obj)
Deprecated.Adds the given object to the pool, provided that the object was created by this pool.
-
-
-
Field Detail
-
MARKER_VALUE
private static final java.lang.Integer MARKER_VALUE
Deprecated.
-
available
private final java.util.concurrent.BlockingQueue<java.lang.ref.WeakReference<T>> available
Deprecated.created, available objects to be checked out to clients
-
onLoan
private final java.util.Map<T,java.lang.Integer> onLoan
Deprecated.Synchronized, identity map of loaned out objects (WeakHashMap); use to ensure we repool only object originating from here and do it once.
-
-
Method Detail
-
createObject
protected abstract T createObject() throws E extends java.lang.Throwable
Deprecated.Called whenever a new pool object is desired; subclasses must implement.
-
getObject
public T getObject() throws E extends java.lang.Throwable
Deprecated.Subclasses can subclass to return a more specific type.
-
repool
public boolean repool(T obj)
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
-
-