LeaseRenewalManager Utility Requirements


ID

LeaseRenewalManager Utility Requirement

Section

Comments

Methods of this class that accept Lease.FOREVER or Lease.ANY as the desired expiration time will treat Lease.FOREVER and Lease.ANY as semantically identical. That is, if either Lease.FOREVER or Lease.ANY is requested, renewal requests will be made indefinitely until a cancellation request is made.

5.4


When the LeaseRenewalManager makes a remote call (for example, when requesting the renewal of a lease), any invocations made on the methods of the LeaseRenewalManager will not be blocked.

"


Should the LeaseRenewalManager invoke a method on a registered listener (a local call), calls from that method to any method of the LeaseRenewalManager are guaranteed not to result in a deadlock condition.



The equals method for this class returns true if and only if two instances of this class refer to the same object. That is, x and y are equal instances of this class if and only if x == y has the value true.



The first form of the constructor takes no arguments. This form of the constructor instantiates a LeaseRenewalManager object that initially manages no leases.



The second form of the constructor creates a LeaseRenewalManager that initially manages a single lease. This form of the constructor requires that a reference to the initial lease be supplied as an argument.



The second form of the constructor creates a LeaseRenewalManager that initially manages a single lease. This form of the constructor … also takes an expiration argument that represents the desired (absolute) time of expiration for the lease …



The second form of the constructor creates a LeaseRenewalManager that initially manages a single lease. This form of the constructor … a reference to a LeaseListener object that receives notifications of exceptional conditions occurring during renewal attempts.



The renewUntil method adds a lease to the set of leases being managed by the LeaseRenewalManager. This method takes as arguments a reference to the lease to manage ...



The renewUntil


What happens if this reference is null?

The renewUntil method adds a lease to the set of leases being managed by the LeaseRenewalManager. This method takes as arguments … the desired (absolute) time of expiration of the lease…



The renewUntil …A value of Lease.ANY or Lease.FOREVER may be passed as the value of the expiration argument,



The renewUntil method adds a lease to the set of leases being managed by the LeaseRenewalManager. This method takes as arguments … a reference to the LeaseListener object that will receive notification of exceptional conditions when attempting lease renewal.



The renewUntil … and the LeaseListener argument may be null.



The renewUntil … If the lease input to this method is already in the set of managed leases, the listener object and the desired expiration associated with that lease will be replaced with the new listener and expiration.



The lease will remain in the set of managed leases until …The lease expires



The lease will remain in the set of managed leases until … The lease is cancelled



The lease will remain in the set of managed leases until … An explicit removal of the lease from the set is requested



The lease will remain in the set of managed leases until … An UnknownLeaseException,a LeaseDeniedException,or any other non-remote exception is received during a lease renewal attempt



The lease will remain in the set of managed leases until … A (remote) NoSuchObjectException is received during a lease renewal attempt



If the value input to this argument does indeed extend beyond the actual lease expiration time, then the lease will be systematically renewed at appropriate times until one of the conditions listed above occurs.



If the value input is less than or equal to the actual expiration time, nothing will be done to modify the time when the lease actually expires. That is, the lease will not be renewed with an expiration time that is less than the originally granted expiration.



If a non-null object reference is passed in for the LeaseListener argument, the object will receive notification of exceptional conditions occurring upon a renewal attempt. In particular, exceptional conditions may include UnknownLeaseException, LeaseDeniedException, and RemoteException, as well as any other non-RemoteException.



If a RemoteException occurs during a renewal request for a lease, renewal requests will continue to be made until either the lease is renewed, or the lease expiration time has been exceeded.



In the latter case, the first RemoteException received will be passed on to the LeaseListener.



The renewFor method adds a lease to the set of leases being managed by the LeaseRenewalManager. This method takes as input a reference to the lease to manage, a long value representing the desired duration of the lease, and a reference to a LeaseListener object that will receive notifications of exceptional conditions when attempting lease renewal. This method will test for arithmetic overflow in the duration parameter. Should such overflow be present, the duration will be set to

Lease.FOREVER. The semantics of this method are identical to those of the renewUntil method described above, with the expiration parameter of renewUntil set to a value of duration + current time (in milliseconds).



The renewFor method adds a lease to the set of leases being managed by the LeaseRenewalManager. This method takes as input a reference to the lease to manage,



The renewFor method adds a lease to the set of leases being managed by the LeaseRenewalManager. This method takes as input … a long value representing the desired duration of the lease,



This method will test for arithmetic overflow in the duration parameter. Should such overflow be present, the duration will be set to Lease.FOREVER.



The renewFor method adds a lease to the set of leases being managed by the LeaseRenewalManager. This method takes as input … a reference to a LeaseListener object that will receive notifications of exceptional conditions when attempting lease renewal.



The semantics of this method are identical to those of the renewUntil method described above, with the expiration parameter of renewUntil set to a value of duration + current time (in milliseconds).



The getExpiration method returns the desired time of expiration requested for a particular lease, not the actual expiration that was originally granted when the lease was created.



The getExpiration method … The only argument to this method is the reference to the lease object.


What about a null reference?

The getExpiration method … If the lease is not in the set of managed leases, an UnknownLeaseException will be thrown.



The setExpiration method replaces the current desired expiration of a given lease contained in the set of managed leases with a new desired expiration time.



The setExpiration method … The only arguments to this method are the reference to the lease object



The setExpiration method … The only arguments to this method are … the new expiration time.



The setExpiration method … If the lease is not in the set of managed leases, an UnknownLeaseException will be thrown.



The remove method removes a given lease from the set of managed leases.



The only argument to this method is the reference to the lease object.


What about null?

If the lease is not in the set of managed leases, an UnknownLeaseException will be thrown.



The cancel method both removes a given lease from the set of managed leases and cancels the given lease.



The cancel method … The only argument to this method is the reference to the lease object.



The cancel method … The only argument to this method is the reference to the lease object. If the lease is not in the set of managed leases, an UnknownLeaseException will be thrown.



The cancel method … The only argument to this method is the reference to the lease object. Any exception (remote or non-remote) occurring during the cancellation of the lease will have no effect on the removal of the lease from the managed set. That is, even if an exception occurs during the cancel operation, the lease must have been removed from the managed set upon return from this method.



The cancel method … The only argument to this method is the reference to the lease object. Any exception thrown by the cancel method of the lease object itself may also be thrown by this method.



The clear method removes all leases from the set of managed leases. It does not request the cancellation of those leases. This method takes no arguments.



The clear method … It does not request the cancellation of those leases.



The LeaseListener interface defines the mechanism through which an entity receives notification from the LeaseRenewalManager that … A lease has expired



The LeaseListener interface defines the mechanism through which an entity receives notification from the LeaseRenewalManager that … A lease renewal request has been denied before the desired absolute expiration time of the lease was reached



When either of the above events occurs, the LeaseRenewalManager will send an instance of LeaseRenewalEvent to that listener object.



With respect to the lease referenced by the event sent to the listener, the LeaseRenewalManager will remove that lease prior to sending the LeaseRenewalEvent.



The LeaseRenewalEvent … The getLease method returns a reference to the Lease object associated with the event. This method takes no arguments.



The getExpiration method returns a long value representing the desired absolute expiration of the Lease object associated with the event. This method takes no input arguments.



The getException method returns the exception that caused the event to be sent.



If the lease’s expiration time is reached before the LeaseRenewalManager can request renewal, a LeaseRenewalEvent will be sent with no associated exception. In this case, invoking this method will return null.



If the LeaseRenewalManager sends a LeaseRenewalEvent because a renewal request was denied, this method will return LeaseDeniedException.



If the LeaseRenewalManager sends a LeaseRenewalEvent because a renewal request could not be completed before the expiration of the lease, this method will return UnknownLeaseException.