Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

gnu.java.security.util
Class ExpirableObject  view ExpirableObject download ExpirableObject.java

java.lang.Object
  extended bygnu.java.security.util.ExpirableObject
All Implemented Interfaces:
javax.security.auth.Destroyable

public abstract class ExpirableObject
extends java.lang.Object
implements javax.security.auth.Destroyable

The base class for objects with sensitive data that are automatically destroyed after a timeout elapses. On creation, an object that extends this class will automatically be added to a java.util.Timer object that, once a timeout elapses, will automatically call the Destroyable.destroy()>Destroyable.destroy() 55 method.

Concrete subclasses must implement the doDestroy() 55 method instead of Destroyable.destroy()>Destroyable.destroy() 55 ; the behavior of that method should match exactly the behavior desired of destroy().

Note that if a javax.security.auth.DestroyFailedException occurs when the timeout expires, it will not be reported.


Nested Class Summary
private  class ExpirableObject.Destroyer
          The task that destroys the target when the timeout elapses.
 
Field Summary
static long DEFAULT_TIMEOUT
          The default timeout, used in the default constructor.
private  ExpirableObject.Destroyer destroyer
          A reference to the task that will destroy this object when the timeout expires.
private static java.util.Timer EXPIRER
          The timer that expires instances.
 
Constructor Summary
protected ExpirableObject()
          Create a new expirable object that will expire after one hour.
protected ExpirableObject(long delay)
          Create a new expirable object that will expire after the specified timeout.
 
Method Summary
 void destroy()
          Destroys this object.
protected abstract  void doDestroy()
          Subclasses must implement this method instead of the Destroyable.destroy()>Destroyable.destroy() 55 method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.security.auth.Destroyable
isDestroyed
 

Field Detail

DEFAULT_TIMEOUT

public static final long DEFAULT_TIMEOUT
The default timeout, used in the default constructor.

See Also:
Constant Field Values

EXPIRER

private static final java.util.Timer EXPIRER
The timer that expires instances.


destroyer

private final ExpirableObject.Destroyer destroyer
A reference to the task that will destroy this object when the timeout expires.

Constructor Detail

ExpirableObject

protected ExpirableObject()
Create a new expirable object that will expire after one hour.


ExpirableObject

protected ExpirableObject(long delay)
Create a new expirable object that will expire after the specified timeout.

Method Detail

destroy

public final void destroy()
                   throws javax.security.auth.DestroyFailedException
Destroys this object. This method calls doDestroy, then, if no exception is thrown, cancels the task that would destroy this object when the timeout is reached.

Specified by:
destroy in interface javax.security.auth.Destroyable

doDestroy

protected abstract void doDestroy()
                           throws javax.security.auth.DestroyFailedException
Subclasses must implement this method instead of the Destroyable.destroy()>Destroyable.destroy() 55 method.