GigaSpaces XAP 9.5 API

com.sun.jini.lease
Class AbstractLease

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

public abstract class AbstractLease
extends Object
implements Lease, Serializable

A base class for implementing lease objects. This class takes care of absolute vs relative time issues and implements some of the Lease methods. The subclass is responsible for implementing: doRenew, cancel, createLeaseMap, canBatch, hashCode, equals, and serialization of any subclass state.

Author:
Sun Microsystems, Inc.
See Also:
Serialized Form

Field Summary
protected  long expiration
          The lease expiration, in local absolute time.
protected  int serialFormat
          Serialization format for the expiration.
 
Fields inherited from interface net.jini.core.lease.Lease
ABSOLUTE, ANY, DURATION, FOREVER
 
Constructor Summary
protected AbstractLease(long expiration)
          Construct a relative-format lease.
 
Method Summary
protected abstract  long doRenew(long duration)
          Renew the lease for a duration relative to now, and return the duration actually granted.
 long getExpiration()
          Return the lease expiration.
 int getSerialFormat()
          Return the serialization format for the expiration.
 void renew(long duration)
          Renew the lease for a duration relative to now.
 void setSerialFormat(int format)
          Set the serialization format for the expiration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.jini.core.lease.Lease
canBatch, cancel, createLeaseMap
 

Field Detail

expiration

protected transient long expiration
The lease expiration, in local absolute time.


serialFormat

protected int serialFormat
Serialization format for the expiration.

Constructor Detail

AbstractLease

protected AbstractLease(long expiration)
Construct a relative-format lease.

Method Detail

getExpiration

public long getExpiration()
Return the lease expiration.

Specified by:
getExpiration in interface Lease
Returns:
a long that indicates the time that the lease will expire

getSerialFormat

public int getSerialFormat()
Return the serialization format for the expiration.

Specified by:
getSerialFormat in interface Lease
Returns:
an int representing the serial format value
See Also:
Lease.setSerialFormat(int)

setSerialFormat

public void setSerialFormat(int format)
Set the serialization format for the expiration.

Specified by:
setSerialFormat in interface Lease
Parameters:
format - DURATION or ABSOLUTE
See Also:
Lease.getSerialFormat()

renew

public void renew(long duration)
           throws UnknownLeaseException,
                  LeaseDeniedException,
                  RemoteException
Renew the lease for a duration relative to now.

Specified by:
renew in interface Lease
Parameters:
duration - the requested duration in milliseconds
Throws:
UnknownLeaseException - the lease being renewed is unknown to the lease grantor
LeaseDeniedException - the lease grantor is unable or unwilling to renew the lease
RemoteException

doRenew

protected abstract long doRenew(long duration)
                         throws UnknownLeaseException,
                                LeaseDeniedException,
                                RemoteException
Renew the lease for a duration relative to now, and return the duration actually granted.

Throws:
UnknownLeaseException
LeaseDeniedException
RemoteException

GigaSpaces XAP 9.5 API

Copyright © GigaSpaces.