T
- the type of the underlying object that the wrapped SoftReference
refers to.public class PooledSoftReference<T> extends DefaultPooledObject<T>
DefaultPooledObject
to wrap pooled soft references.
This class is intended to be thread-safe.
Constructor and Description |
---|
PooledSoftReference(java.lang.ref.SoftReference<T> reference)
Creates a new PooledSoftReference wrapping the provided reference.
|
Modifier and Type | Method and Description |
---|---|
T |
getObject()
Returns the object that the wrapped SoftReference refers to.
|
java.lang.ref.SoftReference<T> |
getReference()
Returns the SoftReference wrapped by this object.
|
void |
setReference(java.lang.ref.SoftReference<T> reference)
Sets the wrapped reference.
|
java.lang.String |
toString()
Provides a String form of the wrapper for debug purposes.
|
allocate, compareTo, deallocate, endEvictionTest, getActiveTimeMillis, getBorrowedCount, getCreateTime, getIdleTimeMillis, getLastBorrowTime, getLastReturnTime, getLastUsedTime, getState, invalidate, markAbandoned, markReturning, printStackTrace, setLogAbandoned, setRequireFullStackTrace, startEvictionTest, use
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
equals, hashCode
public PooledSoftReference(java.lang.ref.SoftReference<T> reference)
reference
- SoftReference to be managed by the poolpublic T getObject()
Note that if the reference has been cleared, this method will return null.
getObject
in interface PooledObject<T>
getObject
in class DefaultPooledObject<T>
public java.lang.String toString()
toString
in interface PooledObject<T>
toString
in class DefaultPooledObject<T>
public java.lang.ref.SoftReference<T> getReference()
public void setReference(java.lang.ref.SoftReference<T> reference)
This method exists to allow a new, non-registered reference to be
held by the pool to track objects that have been checked out of the pool.
The actual parameter should be a reference to the same
object that getObject()
returns before calling this method.
reference
- new referenceCopyright © 2000-2018 Apache Software Foundation. All Rights Reserved.