org.erights.e.extern.timer
Class Retainer

java.lang.Object
  |
  +--org.erights.e.extern.timer.Retainer
All Implemented Interfaces:
Marker, Persistent, Runnable, Serializable
Direct Known Subclasses:
SwissRetainer

public class Retainer
extends Object
implements Persistent, Runnable

Untamed: Used as a timed self-removing persistent key in a map.

After construction or unserialization, the Retainer isn't in a valid state until init() is called. We don't automate this with readResolve() in order to avoid a circular unserialization bug.

Author:
Mark S. Miller
See Also:
Serialized Form

Field Summary
protected  long myOptExpirationDate
           
private  FlexMap myOptRetainers
           
private  Timeout myOptTimeout
           
protected  Timer myOptTimer
           
(package private) static long serialVersionUID
           
 
Fields inherited from interface org.erights.e.elib.serial.Persistent
HONORARY, HONORED_NAMES
 
Constructor Summary
Retainer()
          Enabled: optExpirationDate defaults to forever (java.lang.Long#MAX_VALUE), so optTimer also defaults to null.
Retainer(Timer optTimer, long optExpirationDate)
          Enabled:
 
Method Summary
protected  void init(FlexMap retainers)
          After construction or unserialization, the Retainer isn't in a valid state until init() is called.
 void run()
          Enabled:
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

static final long serialVersionUID

myOptRetainers

private transient FlexMap myOptRetainers

myOptTimer

protected Timer myOptTimer

myOptTimeout

private Timeout myOptTimeout

myOptExpirationDate

protected long myOptExpirationDate
Constructor Detail

Retainer

public Retainer()
Enabled: optExpirationDate defaults to forever (java.lang.Long#MAX_VALUE), so optTimer also defaults to null.


Retainer

public Retainer(Timer optTimer,
                long optExpirationDate)
Enabled:

Parameters:
optTimer - May be null ONLY if optExpirationDate is Long.MAX_VALUE.
optExpirationDate -
Method Detail

init

protected void init(FlexMap retainers)
After construction or unserialization, the Retainer isn't in a valid state until init() is called. We don't automate this with readResolve() in order to avoid a circular unserialization bug.

Parameters:
retainers - This retainer will remove itself as a key from retainers when it expires or is invoked.

run

public void run()
Enabled:

Specified by:
run in interface Runnable
See Also:
java.lang.Thread#run()


comments?