public class LandlordLease extends AbstractLease implements ReferentUuid, ID<Uuid>
net.jini.core.lease.Lease that works
with the the Landlord protocol.Landlord,
Serialized Formexpiration, serialFormat| Constructor and Description |
|---|
LandlordLease(Uuid cookie,
Landlord landlord,
Uuid landlordUuid,
long expiration)
Create a new
LandlordLease. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canBatch(Lease lease)
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.
|
void |
cancel()
Used by the lease holder to indicate that it is no longer interested
in the resource or information held by the lease.
|
LeaseMap<? extends Lease,Long> |
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 long |
doRenew(long renewDuration)
Renew the lease for a duration relative to now, and return
the duration actually granted.
|
boolean |
equals(Object other) |
Uuid |
getReferentUuid()
Return the
Uuid that has been assigned to the
resource this proxy represents. |
int |
hashCode() |
Uuid |
identity() |
String |
toString() |
getExpiration, getSerialFormat, renew, setSerialFormatpublic LandlordLease(Uuid cookie, Landlord landlord, Uuid landlordUuid, long expiration)
LandlordLease.cookie - a Uuid that universally and uniquely
identifies the lease this object is to be a proxy forlandlord - Landlord object 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 the Uuid landlord.getUuid would
return if landlord implemented
ReferentUuid. 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 epochNullPointerException - if landlord,
landlordUuid or cookie
is nullpublic void cancel()
throws UnknownLeaseException,
RemoteException
Leasecancel in interface LeaseUnknownLeaseException - the lease being cancelled is unknown
to the lease grantorRemoteExceptionprotected long doRenew(long renewDuration)
throws LeaseDeniedException,
UnknownLeaseException,
RemoteException
AbstractLeasedoRenew in class AbstractLeaseLeaseDeniedExceptionUnknownLeaseExceptionRemoteExceptionpublic Uuid getReferentUuid()
ReferentUuidUuid that has been assigned to the
resource this proxy represents.getReferentUuid in interface ReferentUuidUuid associated with the
resource this proxy represents. Will not
return null.public boolean canBatch(Lease lease)
Leasepublic LeaseMap<? extends Lease,Long> createLeaseMap(long duration)
LeasecreateLeaseMap in interface Leaseduration - the duration to put into a Long and use as the
value for the current lease in the created LeaseMapCopyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.