Package com.sun.jini.lease
Class AbstractLease
java.lang.Object
com.sun.jini.lease.AbstractLease
- All Implemented Interfaces:
Serializable,Lease
- Direct Known Subclasses:
EventLease,LandlordLease
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:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected longThe lease expiration, in local absolute time.protected intSerialization format for the expiration. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractLease(long expiration) Construct a relative-format lease. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract longdoRenew(long duration) Renew the lease for a duration relative to now, and return the duration actually granted.longReturn the lease expiration.intReturn the serialization format for the expiration.voidrenew(long duration) Renew the lease for a duration relative to now.voidsetSerialFormat(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, waitMethods inherited from interface net.jini.core.lease.Lease
canBatch, cancel, createLeaseMap
-
Field Details
-
expiration
protected transient long expirationThe lease expiration, in local absolute time. -
serialFormat
protected int serialFormatSerialization format for the expiration.
-
-
Constructor Details
-
AbstractLease
protected AbstractLease(long expiration) Construct a relative-format lease.
-
-
Method Details
-
getExpiration
public long getExpiration()Return the lease expiration.- Specified by:
getExpirationin interfaceLease- Returns:
- a
longthat indicates the time that the lease will expire
-
getSerialFormat
public int getSerialFormat()Return the serialization format for the expiration.- Specified by:
getSerialFormatin interfaceLease- Returns:
- an int representing the serial format value
- See Also:
-
setSerialFormat
public void setSerialFormat(int format) Set the serialization format for the expiration.- Specified by:
setSerialFormatin interfaceLease- Parameters:
format- DURATION or ABSOLUTE- See Also:
-
renew
public void renew(long duration) throws UnknownLeaseException, LeaseDeniedException, RemoteException Renew the lease for a duration relative to now.- Specified by:
renewin interfaceLease- Parameters:
duration- the requested duration in milliseconds- Throws:
UnknownLeaseException- the lease being renewed is unknown to the lease grantorLeaseDeniedException- the lease grantor is unable or unwilling to renew the leaseRemoteException
-
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.
-