Class LeaseRenewalEvent
- All Implemented Interfaces:
Serializable
LeaseRenewalManager cannot renew a lease. The
LeaseRenewalEvent instances are sent to the LeaseListener (if any)
associated with a given lease when the lease was added to the managed set. These events are
typically generated because one of the following conditions occur:
- After successfully
renewing a lease any number of times and experiencing no failures, the
LeaseRenewalManagerdetermines, prior to the next renewal attempt, that the actual expiration time of the lease has passed, implying that any further attempt to renew the lease would be fruitless. - An indefinite exception occurs during each attempt to renew a lease,
from the point that the first such exception occurs until the point when the
LeaseRenewalManagerdetermines that lease's actual expiration time has passed. - A definite exception occurs during a lease renewal attempt.
Note that bad object
exceptions, bad invocation exceptions, and LeaseExceptions are all considered
definite exceptions.
This class encapsulates information about both the lease for which the failure occurred, as well as information about the condition that caused the renewal attempt to fail.
This class is a subclass of the class EventObject, adding the following
additional items of abstract state:
- The lease on which the renewal attempt failed, and to which the event pertains
- The desired expiration time of the affected lease
- The
Throwableassociated with the last renewal attempt (if any)
In addition to
the methods of the EventObject class, this class defines methods through which this
additional state may be retrieved.
The source associated with a
LeaseRenewalEvent will be the LeaseRenewalManager that generated the
event.
- Author:
- Sun Microsystems, Inc.
- See Also:
-
Field Summary
Fields inherited from class java.util.EventObject
source -
Constructor Summary
ConstructorsConstructorDescriptionLeaseRenewalEvent(Object source, Lease lease, long expiration, Throwable ex) Constructs an instance of this class with the specified state. -
Method Summary
Modifier and TypeMethodDescriptionReturns the exception (if any) that caused the event to be sent.longReturns the desired expiration time of the lease to which event pertains.getLease()Returns a reference to the lease to which the event pertains.Methods inherited from class java.util.EventObject
getSource, toString
-
Constructor Details
-
LeaseRenewalEvent
Constructs an instance of this class with the specified state.- Parameters:
source- reference to the instance of theLeaseRenewalManagerthat generated the eventlease- the lease to which the event pertainsexpiration- the desired expiration time for the affected leaseex- theThrowableassociated with the last renewal attempt (if any)- See Also:
-
-
Method Details
-
getLease
Returns a reference to the lease to which the event pertains.- Returns:
- the
Leaseobject corresponding to the lease on which the renewal attempt failed - See Also:
-
getExpiration
public long getExpiration()Returns the desired expiration time of the lease to which event pertains.- Returns:
- a
longvalue that represents the desired expiration time of the lease on which the renewal attempt failed
-
getException
Returns the exception (if any) that caused the event to be sent. The conditions under which the event may be sent, and the related values returned by this method, are as follows:- When any lease in the managed set has passed its actual expiration time, and either the
most recent renewal attempt was successful or there have been no renewal attempts, the
LeaseRenewalManagerwill cease any further attempts to renew the lease, and will send aLeaseRenewalEventwith no associated exception. In this case, invoking this method will returnnull. - For any lease from the managed set for which
the most recent renewal attempt was unsuccessful because of the occurrence of a indefinite
exception, the
LeaseRenewalManagerwill continue to attempt to renew the affected lease at the appropriate times until: the renewal succeeds, the lease's expiration time has passed, or a renewal attempt throws a definite exception. If a definite exception is thrown or the lease expires, theLeaseRenewalManagerwill cease any further attempts to renew the lease, and will send aLeaseRenewalEventcontaining the exception associated with the last renewal attempt. - If, while attempting to renew a
lease from the managed set, a definite exception is encountered, the
LeaseRenewalManagerwill cease any further attempts to renew the lease, and will send aLeaseRenewalEventcontaining the particular exception that occurred.
- Returns:
- an instance of
Throwableornull, indicating the condition that caused theLeaseRenewalManagerto fail to renew the affected lease
- When any lease in the managed set has passed its actual expiration time, and either the
most recent renewal attempt was successful or there have been no renewal attempts, the
-