Class EventLease

java.lang.Object
com.sun.jini.lease.AbstractLease
com.sun.jini.reggie.EventLease
All Implemented Interfaces:
Serializable, Lease, ReferentUuid
Direct Known Subclasses:
ConstrainableEventLease

public class EventLease extends AbstractLease
When a registrar (lookup service) grants a lease on an event registration on behalf of some object (client), a proxy is employed to allow the client to interact with the lease; this class is the implementation of that proxy. Clients only see instances of this class via the Lease interface.
Author:
Sun Microsystems, Inc.
See Also:
  • Method Details

    • cancel

      public void cancel() throws UnknownLeaseException, RemoteException
      Description copied from interface: Lease
      Used by the lease holder to indicate that it is no longer interested in the resource or information held by the lease. If the leased information or resource could cause a callback to the lease holder (or some other object on behalf of the lease holder), the lease grantor should not issue such a callback after the lease has been cancelled. The overall effect of a cancel call is the same as lease expiration, but instead of happening at the end of a pre-agreed duration it happens immediately.
      Throws:
      UnknownLeaseException - the lease being cancelled is unknown to the lease grantor
      RemoteException
    • doRenew

      protected long doRenew(long duration) throws UnknownLeaseException, RemoteException
      Renews the event lease associated with an instance of this class. Each instance of this class corresponds to a lease on an event registration for a particular client. This method renews that lease on behalf of the client.
      Specified by:
      doRenew in class AbstractLease
      Parameters:
      duration - the requested duration for the lease being renewed
      Returns:
      long value representing the new duration that was granted for the renewed lease. Note that the duration returned may be less than the duration requested.
      Throws:
      UnknownLeaseException - indicates the lease does not exist; typically because the lease has expired.
      RemoteException
    • createLeaseMap

      public LeaseMap createLeaseMap(long duration)
      Creates a lease map.
      Specified by:
      createLeaseMap in interface Lease
      Parameters:
      duration - the duration to put into a Long and use as the value for the current lease in the created LeaseMap
      Returns:
      the created LeaseMap object
    • canBatch

      public boolean canBatch(Lease lease)
      Two leases can be batched if they are both RegistrarLeases and have the same server.
      Specified by:
      canBatch in interface Lease
      Parameters:
      lease - the Lease to be evaluated
      Returns:
      a boolean indicating whether or not the lease given as a parameter can be batched (placed in the same LeaseMap) with the current lease
    • getReferentUuid

      public Uuid getReferentUuid()
      Returns the lease Uuid.
      Specified by:
      getReferentUuid in interface ReferentUuid
      Returns:
      the Uuid associated with the resource this proxy represents. Will not return null.
    • hashCode

      public int hashCode()
      Returns the lease Uuid's hash code.
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Returns true if lease Uuids match, false otherwise.
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Returns a string created from the proxy class name, the registrar's service ID, the id of the lessee or event (depending on the subclass), and the result of the underlying server proxy's toString method.
      Overrides:
      toString in class Object
      Returns:
      String