Package com.sun.jini.landlord
Class ConstrainableLandlordLease
java.lang.Object
com.sun.jini.lease.AbstractLease
com.sun.jini.landlord.LandlordLease
com.sun.jini.landlord.ConstrainableLandlordLease
- All Implemented Interfaces:
Serializable,RemoteMethodControl,Lease,ReferentUuid
Constrainable sub-class of
LandlordLease. Instances of this class can be verified
using the LandlordProxyVerifier class.- Since:
- 2.0
- Author:
- Sun Microsystems, Inc.
- See Also:
-
Field Summary
Fields inherited from class com.sun.jini.lease.AbstractLease
expiration, serialFormat -
Constructor Summary
ConstructorsConstructorDescriptionConstrainableLandlordLease(Uuid cookie, Landlord landlord, Uuid landlordUuid, long expiration, MethodConstraints methodConstraints) Create a newConstrainableLandlordLease. -
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.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.Returns the client constraints placed on this proxy.setConstraints(MethodConstraints constraints) Returns a new copy of this proxy with the client constraints set to the specified constraints.Methods inherited from class com.sun.jini.landlord.LandlordLease
cancel, doRenew, equals, getReferentUuid, hashCode, setLandlord, toStringMethods inherited from class com.sun.jini.lease.AbstractLease
getExpiration, getSerialFormat, renew, setSerialFormat
-
Constructor Details
-
ConstrainableLandlordLease
public ConstrainableLandlordLease(Uuid cookie, Landlord landlord, Uuid landlordUuid, long expiration, MethodConstraints methodConstraints) Create a newConstrainableLandlordLease.- 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 lease.landlordUuid- 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.methodConstraints- the client method constraints to place on this proxy (may benull).- Throws:
NullPointerException- iflandlord,landlordUuid, orcookieisnull.ClassCastException- iflandlorddoes not implementRemoteMethodControl.
-
-
Method Details
-
setConstraints
Description copied from interface:RemoteMethodControlReturns a new copy of this proxy with the client constraints set to the specified constraints. These constraints completely replace (in the copy) any client constraints previously placed on this proxy; calling thegetConstraintsmethod of the copy returns the identical constraints instance. The original proxy is not modified. Anullvalue is interpreted as mapping all methods to empty constraints (one that has no requirements and no preferences). For any given remote call, the specific client requirements and preferences to be satisfied are given by the return value of invoking thegetConstraintsmethod of the specifiedMethodConstraintsinstance with aMethodobject representing the remote method.Client constraints placed on a proxy are included in the serialized state of the proxy. This allows third-party services to be transparent to the client's needs. For example, if remote object
s1obtains a proxy for remote objects2, and passes that proxy to remote objects3, expectings3to invoke a remote method ons2, thens1can control that call by placing its constraints directly on the proxy before passing it tos3. Ifs3does not wish to be transparent in this way, then it should explicitly replace the client constraints on received proxies with whatever constraints are appropriate to implement its own policy.- Specified by:
setConstraintsin interfaceRemoteMethodControl- Parameters:
constraints- client constraints, ornull- Returns:
- a new copy of this proxy with the client constraints set to the specified constraints
- See Also:
-
getConstraints
Description copied from interface:RemoteMethodControlReturns the client constraints placed on this proxy. The return value can benull, which is interpreted as mapping all methods to empty constraints (one that has no requirements and no preferences).- Specified by:
getConstraintsin interfaceRemoteMethodControl- Returns:
- the client constraints, or
null - See Also:
-
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.- Specified by:
canBatchin interfaceLease- Overrides:
canBatchin classLandlordLease- Parameters:
lease- the Lease to be evaluated- 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
-
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- Overrides:
createLeaseMapin classLandlordLease- 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
-