diff options
| author | Raif S. Naffah <raif@swiftdsl.com.au> | 2006-06-24 00:09:26 +0000 |
|---|---|---|
| committer | Raif S. Naffah <raif@swiftdsl.com.au> | 2006-06-24 00:09:26 +0000 |
| commit | c6a7fb5cb0459d9cfdb13834868c4b3c87fa7b7e (patch) | |
| tree | 25d8bec8afc47cbf7f95d62517939fbbf1383a87 /gnu/java/security/util/ExpirableObject.java | |
| parent | 6c181a1fd8daf166b48fa352fb3d8963d182c3d5 (diff) | |
| download | classpath-c6a7fb5cb0459d9cfdb13834868c4b3c87fa7b7e.tar.gz | |
2006-06-24 Raif S. Naffah <raif@swiftdsl.com.au>
* gnu/java/security/util/Util.java: Source formatting.
* gnu/java/security/util/SimpleList.java: Likewise.
* gnu/java/security/util/Sequence.java: Likewise.
* gnu/java/security/util/PRNG.java: Likewise.
* gnu/java/security/util/ExpirableObject.java: Likewise.
* gnu/java/security/util/Base64.java: Likewise.
* gnu/java/security/sig/SignatureFactory.java: Likewise.
* gnu/java/security/sig/ISignatureCodec.java: Likewise.
* gnu/java/security/sig/ISignature.java: Likewise.
* gnu/java/security/sig/BaseSignature.java: Likewise.
* gnu/java/security/sig/rsa/RSAPSSSignatureRawCodec.java: Likewise.
* gnu/java/security/sig/rsa/RSAPSSSignature.java: Likewise.
* gnu/java/security/sig/rsa/RSAPKCS1V1_5Signature.java: Likewise.
* gnu/java/security/sig/rsa/RSA.java: Likewise.
* gnu/java/security/sig/rsa/EMSA_PSS.java: Likewise.
* gnu/java/security/sig/rsa/EMSA_PKCS1_V1_5.java: Likewise.
* gnu/java/security/sig/rsa/EME_PKCS1_V1_5.java: Likewise.
* gnu/java/security/sig/dss/DSSSignatureRawCodec.java: Likewise.
* gnu/java/security/sig/dss/DSSSignature.java: Likewise.
* gnu/java/security/provider/X509CertificateFactory.java: Likewise.
* gnu/java/security/provider/PKIXCertPathValidatorImpl.java: Likewise.
* gnu/java/security/provider/Gnu.java: Likewise.
* gnu/java/security/prng/RandomEventListener.java: Likewise.
* gnu/java/security/prng/RandomEvent.java: Likewise.
* gnu/java/security/prng/PRNGFactory.java: Likewise.
* gnu/java/security/prng/MDGenerator.java: Likewise.
* gnu/java/security/prng/LimitReachedException.java: Likewise.
* gnu/java/security/prng/IRandom.java: Likewise.
* gnu/java/security/prng/EntropySource.java: Likewise.
* gnu/java/security/prng/BasePRNG.java: Likewise.
Diffstat (limited to 'gnu/java/security/util/ExpirableObject.java')
| -rw-r--r-- | gnu/java/security/util/ExpirableObject.java | 70 |
1 files changed, 24 insertions, 46 deletions
diff --git a/gnu/java/security/util/ExpirableObject.java b/gnu/java/security/util/ExpirableObject.java index c14b75957..e0c4e6b59 100644 --- a/gnu/java/security/util/ExpirableObject.java +++ b/gnu/java/security/util/ExpirableObject.java @@ -46,26 +46,23 @@ import 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 {@link Timer} object that, - * once a timeout elapses, will automatically call the {@link - * Destroyable#destroy()} method. - * - * <p>Concrete subclasses must implement the {@link #doDestroy()} method - * instead of {@link Destroyable#destroy()}; the behavior of that method - * should match exactly the behavior desired of <code>destroy()</code>. - * - * <p>Note that if a {@link DestroyFailedException} occurs when the timeout + * destroyed after a timeout elapses. On creation, an object that extends this + * class will automatically be added to a {@link Timer} object that, once a + * timeout elapses, will automatically call the {@link Destroyable#destroy()} + * method. + * <p> + * Concrete subclasses must implement the {@link #doDestroy()} method instead of + * {@link Destroyable#destroy()}; the behavior of that method should match + * exactly the behavior desired of <code>destroy()</code>. + * <p> + * Note that if a {@link DestroyFailedException} occurs when the timeout * expires, it will not be reported. - * + * * @see Destroyable */ -public abstract class ExpirableObject implements Destroyable +public abstract class ExpirableObject + implements Destroyable { - - // Constants and fields. - // ------------------------------------------------------------------------- - /** * The default timeout, used in the default constructor. */ @@ -82,9 +79,6 @@ public abstract class ExpirableObject implements Destroyable */ private final Destroyer destroyer; - // Constructors. - // ------------------------------------------------------------------------- - /** * Create a new expirable object that will expire after one hour. */ @@ -94,12 +88,11 @@ public abstract class ExpirableObject implements Destroyable } /** - * Create a new expirable object that will expire after the specified - * timeout. - * + * Create a new expirable object that will expire after the specified timeout. + * * @param delay The delay before expiration. * @throws IllegalArgumentException If <i>delay</i> is negative, or if - * <code>delay + System.currentTimeMillis()</code> is negative. + * <code>delay + System.currentTimeMillis()</code> is negative. */ protected ExpirableObject(final long delay) { @@ -107,14 +100,11 @@ public abstract class ExpirableObject implements Destroyable EXPIRER.schedule(destroyer, delay); } - // Instance methods. - // ------------------------------------------------------------------------- - /** - * Destroys this object. This method calls {@link #doDestroy}, then, if - * no exception is thrown, cancels the task that would destroy this object - * when the timeout is reached. - * + * Destroys this object. This method calls {@link #doDestroy}, then, if no + * exception is thrown, cancels the task that would destroy this object when + * the timeout is reached. + * * @throws DestroyFailedException If this operation fails. */ public final void destroy() throws DestroyFailedException @@ -126,42 +116,30 @@ public abstract class ExpirableObject implements Destroyable /** * Subclasses must implement this method instead of the {@link * Destroyable#destroy()} method. - * + * * @throws DestroyFailedException If this operation fails. */ protected abstract void doDestroy() throws DestroyFailedException; - // Inner classes. - // ------------------------------------------------------------------------- - /** * The task that destroys the target when the timeout elapses. */ - private final class Destroyer extends TimerTask + private final class Destroyer + extends TimerTask { - - // Fields. - // ----------------------------------------------------------------------- - private final ExpirableObject target; - // Constructor. - // ----------------------------------------------------------------------- - Destroyer(final ExpirableObject target) { super(); this.target = target; } - // Instance methods. - // ----------------------------------------------------------------------- - public void run() { try { - if (!target.isDestroyed()) + if (! target.isDestroyed()) target.doDestroy(); } catch (DestroyFailedException dfe) |
