public class LeaseProxy extends Object implements LeaseContext, SmartExternalizable
Message o = new Message ("A");
Lease lease = space.write(o, null, Lease.FOREVER);
LeaseProxy lp = (LeaseProxy) lease;
String uid = lp.getUID();
| Modifier and Type | Field and Description |
|---|---|
protected long |
_expirationTime |
| Modifier | Constructor and Description |
|---|---|
|
LeaseProxy()
Required for
Externalizable. |
protected |
LeaseProxy(LeaseProxy lease) |
|
LeaseProxy(long expirationTime,
String uid,
String classname,
int version,
int objectType) |
|
LeaseProxy(long expirationTime,
String uid,
String classname,
int version,
int objectType,
SpaceImpl spaceImpl) |
| 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 |
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.
|
String |
getClassname()
Returns a class name of lease resource( Entry/Notify Template ).
|
long |
getExpiration()
Returns a
long that indicates the time that the lease will expire. |
Object |
getObject()
returns the previous value associated with this update-or-write operation.
|
int |
getObjectType() |
int |
getSerialFormat()
Returns the format that will be used to serialize the lease.
|
IRemoteSpace |
getSpace() |
String |
getUID()
Returns UID of written Entry.
|
int |
getVersion()
Returns the version of written \ updated entry.
|
void |
readExternal(ObjectInput in) |
void |
renew(long duration)
Used to renew a lease for an additional period of time, specified in milliseconds.
|
void |
setExpiration(long exprTime) |
void |
setObject(Object obj) |
void |
setRemoteSpace(IRemoteSpace remoteSpace) |
void |
setSerialFormat(int format)
Sets the format to use when serializing the lease.
|
void |
setUID(String uid) |
void |
writeExternal(ObjectOutput out) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitenabledSmartExternalizableWithReferencepublic LeaseProxy()
Externalizable.public LeaseProxy(long expirationTime,
String uid,
String classname,
int version,
int objectType)
public LeaseProxy(long expirationTime,
String uid,
String classname,
int version,
int objectType,
SpaceImpl spaceImpl)
protected LeaseProxy(LeaseProxy lease)
public long getExpiration()
Leaselong 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 Leaselong that indicates the time that the lease will expirepublic void setExpiration(long exprTime)
public int getSerialFormat()
LeasegetSerialFormat in interface LeaseLease.setSerialFormat(int)public void setSerialFormat(int format)
LeasesetSerialFormat in interface Leaseformat - DURATION or ABSOLUTELease.getSerialFormat()public void cancel()
throws UnknownLeaseException,
RemoteException
Leasecancel in interface LeaseUnknownLeaseException - the lease being cancelled is unknown to the lease grantorRemoteExceptionpublic void renew(long duration)
throws LeaseDeniedException,
UnknownLeaseException,
RemoteException
Leaserenew in interface Leaseduration - 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 grantorRemoteExceptionpublic boolean canBatch(Lease lease)
Leasepublic LeaseMap 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 LeaseMappublic String getUID()
LeaseContextgetUID in interface LeaseContextpublic void setUID(String uid)
public int getVersion()
LeaseContextgetVersion in interface LeaseContextpublic Object getObject()
LeaseContextWriteModifiers.RETURN_PREV_ON_UPDATE is used, otherwise null)getObject in interface LeaseContextpublic void setObject(Object obj)
public int getObjectType()
public String getClassname()
public IRemoteSpace getSpace()
public void setRemoteSpace(IRemoteSpace remoteSpace)
public void writeExternal(ObjectOutput out) throws IOException
writeExternal in interface ExternalizableIOExceptionpublic void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal in interface ExternalizableIOExceptionClassNotFoundExceptionCopyright © GigaSpaces.