public class LeaseRenewalEvent extends EventObject
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:
LeaseRenewalManager
determines, 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.
LeaseRenewalManager
determines that lease's actual expiration time has passed.
Note that bad object exceptions, bad invocation exceptions, and
LeaseException
s 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:
Throwable
associated 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.
Lease
,
LeaseException
,
LeaseRenewalManager
,
LeaseListener
,
EventObject
,
Serialized Formsource
Constructor and Description |
---|
LeaseRenewalEvent(AtomicSerial.GetArg arg) |
LeaseRenewalEvent(LeaseRenewalManager source,
Lease lease,
long expiration,
Throwable ex)
Constructs an instance of this class with the specified state.
|
Modifier and Type | Method and Description |
---|---|
Throwable |
getException()
Returns the exception (if any) that caused the event to be sent.
|
long |
getExpiration()
Returns the desired expiration time of the lease to which event
pertains.
|
Lease |
getLease()
Returns a reference to the lease to which the event pertains.
|
getSource, toString
public LeaseRenewalEvent(LeaseRenewalManager source, Lease lease, long expiration, Throwable ex)
source
- reference to the instance of the
LeaseRenewalManager
that generated the eventlease
- the lease to which the event pertainsexpiration
- the desired expiration time for the affected
leaseex
- the Throwable
associated with the last
renewal attempt (if any)Lease
,
LeaseRenewalManager
public LeaseRenewalEvent(AtomicSerial.GetArg arg) throws IOException
IOException
public Lease getLease()
Lease
object corresponding to the lease
on which the renewal attempt failedLease
public long getExpiration()
long
value that represents the desired
expiration time of the lease on which the renewal attempt
failedpublic Throwable getException()
LeaseRenewalManager
will cease any further
attempts to renew the lease, and will send a
LeaseRenewalEvent
with no associated exception.
In this case, invoking this method will return
null
.
LeaseRenewalManager
will 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, the
LeaseRenewalManager
will cease any further
attempts to renew the lease, and will send a
LeaseRenewalEvent
containing the exception
associated with the last renewal attempt.
LeaseRenewalManager
will cease any further
attempts to renew the lease, and will send a
LeaseRenewalEvent
containing the particular
exception that occurred.
Throwable
or
null
, indicating the condition that caused
the LeaseRenewalManager
to fail to renew the
affected leaseCopyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.