com.sun.jini.reggie
Class EventLease

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

 class EventLease
extends RegistrarLease

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.

Field Summary
(package private)  long eventID
          The eventID returned in the EventRegistration.
private static String LEASE_TYPE
          The type of the lease used in toString() calls.
private static long serialVersionUID
           
 
Fields inherited from class com.sun.jini.reggie.RegistrarLease
leaseID, registrarID, server
 
Fields inherited from class com.sun.jini.lease.AbstractLease
expiration, serialFormat
 
Fields inherited from interface net.jini.core.lease.Lease
ABSOLUTE, ANY, DURATION, FOREVER
 
Constructor Summary
EventLease(Registrar server, ServiceID registrarID, long eventID, Uuid leaseID, long expiration)
          Constructor for use by getInstance(), ConstrainableEventLease.
 
Method Summary
 void cancel()
          Used by the lease holder to indicate that it is no longer interested in the resource or information held by the lease.
protected  long doRenew(long duration)
          Renews the event lease associated with an instance of this class.
(package private) static EventLease getInstance(Registrar server, ServiceID registrarID, long eventID, Uuid leaseID, long expiration)
          Returns EventLease or ConstrainableEventLease instance, depending on whether given server implements RemoteMethodControl.
(package private)  String getLeaseType()
          Returns the type of the lease.
(package private)  Object getRegID()
          Returns the service ID, or the event ID as a Long.
private  void readObjectNoData()
          Throws InvalidObjectException, since data for this class is required.
 
Methods inherited from class com.sun.jini.reggie.RegistrarLease
canBatch, createLeaseMap, equals, getReferentUuid, getRegistrar, getRegistrarID, hashCode, setExpiration, toString
 
Methods inherited from class com.sun.jini.lease.AbstractLease
getExpiration, getSerialFormat, renew, setSerialFormat
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

LEASE_TYPE

private static final String LEASE_TYPE
The type of the lease used in toString() calls.

See Also:
Constant Field Values

eventID

final long eventID
The eventID returned in the EventRegistration.

Constructor Detail

EventLease

EventLease(Registrar server,
           ServiceID registrarID,
           long eventID,
           Uuid leaseID,
           long expiration)
Constructor for use by getInstance(), ConstrainableEventLease.

Method Detail

getInstance

static EventLease getInstance(Registrar server,
                              ServiceID registrarID,
                              long eventID,
                              Uuid leaseID,
                              long expiration)
Returns EventLease or ConstrainableEventLease instance, depending on whether given server implements RemoteMethodControl.


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

getRegID

Object getRegID()
Description copied from class: RegistrarLease
Returns the service ID, or the event ID as a Long.

Specified by:
getRegID in class RegistrarLease

getLeaseType

String getLeaseType()
Description copied from class: RegistrarLease
Returns the type of the lease.

Specified by:
getLeaseType in class RegistrarLease

readObjectNoData

private void readObjectNoData()
                       throws ObjectStreamException
Throws InvalidObjectException, since data for this class is required.

Throws:
ObjectStreamException


Copyright 2007-2010, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.