public abstract class SpaceLease extends Object implements Lease, Textualizable
Modifier and Type | Field and Description |
---|---|
protected long |
_expirationTime |
protected Object |
_routingValue |
protected int |
_serialFormat |
protected IDirectSpaceProxy |
_spaceProxy |
protected String |
_typeName |
protected String |
_uid |
Constructor and Description |
---|
SpaceLease(IDirectSpaceProxy spaceProxy,
String typeName,
String uid,
Object routingValue,
long expiration) |
Modifier and Type | Method and Description |
---|---|
boolean |
canBatch(IDirectSpaceProxy spaceProxy) |
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 |
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.
|
long |
getExpiration()
Returns a
long that indicates the time that the lease will expire. |
protected abstract int |
getLeaseObjectType() |
int |
getSerialFormat()
Returns the format that will be used to serialize the lease.
|
String |
getTypeName() |
String |
getUID() |
void |
renew(long duration)
Used to renew a lease for an additional period of time, specified in milliseconds.
|
void |
setSerialFormat(int serialFormat)
Sets the format to use when serializing the lease.
|
String |
toString() |
void |
toText(Textualizer textualizer) |
protected final IDirectSpaceProxy _spaceProxy
protected final String _typeName
protected final String _uid
protected final Object _routingValue
protected long _expirationTime
protected int _serialFormat
public SpaceLease(IDirectSpaceProxy spaceProxy, String typeName, String uid, Object routingValue, long expiration)
public void toText(Textualizer textualizer)
toText
in interface Textualizable
public long getExpiration()
Lease
long
that indicates the time that the lease will expire. This time is
represented as milliseconds from the beginning of the epoch, relative to the local clock.getExpiration
in interface Lease
long
that indicates the time that the lease will expirepublic int getSerialFormat()
Lease
getSerialFormat
in interface Lease
Lease.setSerialFormat(int)
public void setSerialFormat(int serialFormat)
Lease
setSerialFormat
in interface Lease
serialFormat
- DURATION or ABSOLUTELease.getSerialFormat()
public void cancel() throws UnknownLeaseException, RemoteException
Lease
cancel
in interface Lease
UnknownLeaseException
- the lease being cancelled is unknown to the lease grantorRemoteException
public void renew(long duration) throws LeaseDeniedException, UnknownLeaseException, RemoteException
Lease
renew
in interface Lease
duration
- the requested duration in millisecondsLeaseDeniedException
- the lease grantor is unable or unwilling to renew the leaseUnknownLeaseException
- the lease being renewed is unknown to the lease grantorRemoteException
public LeaseMap createLeaseMap(long duration)
Lease
createLeaseMap
in interface Lease
duration
- the duration to put into a Long and use as the value for the current lease in
the created LeaseMappublic boolean canBatch(Lease lease)
Lease
public boolean canBatch(IDirectSpaceProxy spaceProxy)
public String getTypeName()
public String getUID()
protected abstract int getLeaseObjectType()
Copyright © GigaSpaces.