| org.openide.util.TimedSoftReference
TimedSoftReference | final class TimedSoftReference extends SoftReference implements Runnable(Code) | | A soft reference which is held strongly for a while after last access.
Lifecycle:
- Created. Referent held strongly. A task is scheduled into the request
processor for some time in the future (currently 30 seconds).
- Expired. After the timeout, the reference switches to a normal soft
reference.
- Touched. If the value is accessed before it is garbage collected,
whether the reference is expired or not, the reference is "touched".
This means that the referent is again held strongly and the timeout
is started from scratch.
- Dead. If after expiry there is no access before the next full GC cycle,
the GC algorithm may reclaim the reference. In this case the reference
of course dies. As a bonus, it will try to remove itself as the value
from a map of your choice, to make it convenient to use these references
as values in a caching map without leaking memory for the key.
author: Jesse Glick |
Method Summary | |
public T | get() | public void | run() |
TimedSoftReference | public TimedSoftReference(T o, Map m, Object k)(Code) | | Create a soft reference with timeout.
The supplied map serves double duty as a synchronization lock
for the reference's state changes.
Parameters: o - the referent Parameters: m - a map in which this reference may serve as a value Parameters: k - the key whose value in m may be this reference |
|
|