Package com.sun.jini.landlord
Class LandlordLease
java.lang.Object
com.sun.jini.lease.AbstractLease
com.sun.jini.landlord.LandlordLease
- All Implemented Interfaces:
Serializable,Lease,ReferentUuid
- Direct Known Subclasses:
ConstrainableLandlordLease,MahaloTxnBasicLease
Basic implementation of
net.jini.core.lease.Lease that works with the the Landlord
protocol.- Since:
- 2.0
- Author:
- Sun Microsystems, Inc.
- See Also:
-
Field Summary
Fields inherited from class com.sun.jini.lease.AbstractLease
expiration, serialFormat -
Constructor Summary
ConstructorsConstructorDescriptionLandlordLease(Uuid cookie, Landlord landlord, Uuid landlordUuid, long expiration) Create a newLandlordLease. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns a boolean indicating whether or not the lease given as a parameter can be batched (placed in the same LeaseMap) with the current lease.voidcancel()Used by the lease holder to indicate that it is no longer interested in the resource or information held by the lease.createLeaseMap(long duration) Creates a Map object that can contain leases whose renewal or cancellation can be batched, and adds the current lease to that map.protected longdoRenew(long renewDuration) Renew the lease for a duration relative to now, and return the duration actually granted.booleanReturn theUuidthat has been assigned to the resource this proxy represents.inthashCode()voidsetLandlord(Landlord landlord) toString()Methods inherited from class com.sun.jini.lease.AbstractLease
getExpiration, getSerialFormat, renew, setSerialFormat
-
Constructor Details
-
LandlordLease
Create a newLandlordLease.- Parameters:
cookie- aUuidthat universally and uniquely identifies the lease this object is to be a proxy forlandlord-Landlordobject that will be used to communicate renew and cancel requests to the granter of the leaselandlordUuid- a universally unique id that has been assigned to the server granting of the lease. Ideally theUuidlandlord.getUuidwould return iflandlordimplementedReferentUuid. Used to determine when two leases can be batched together.expiration- the initial expiration time of the lease in milliseconds since the beginning of the epoch- Throws:
NullPointerException- iflandlord,landlordUuidorcookieis null
-
-
Method Details
-
cancel
Description copied from interface:LeaseUsed 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.- Specified by:
cancelin interfaceLease- Throws:
UnknownLeaseException- the lease being cancelled is unknown to the lease grantorRemoteException
-
doRenew
protected long doRenew(long renewDuration) throws LeaseDeniedException, UnknownLeaseException, RemoteException Description copied from class:AbstractLeaseRenew the lease for a duration relative to now, and return the duration actually granted.- Specified by:
doRenewin classAbstractLease- Throws:
LeaseDeniedExceptionUnknownLeaseExceptionRemoteException
-
getReferentUuid
Description copied from interface:ReferentUuidReturn theUuidthat has been assigned to the resource this proxy represents.- Specified by:
getReferentUuidin interfaceReferentUuid- Returns:
- the
Uuidassociated with the resource this proxy represents. Will not returnnull.
-
equals
-
canBatch
Description copied from interface:LeaseReturns a boolean indicating whether or not the lease given as a parameter can be batched (placed in the same LeaseMap) with the current lease. Whether or not two Lease objects can be batched is an implementation detail determined by the objects. -
createLeaseMap
Description copied from interface:LeaseCreates a Map object that can contain leases whose renewal or cancellation can be batched, and adds the current lease to that map. The current lease is put in the map with the duration value given by the parameter.- Specified by:
createLeaseMapin interfaceLease- 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
-
hashCode
public int hashCode() -
toString
-
setLandlord
-