public class LeaseProxy extends Object implements LeaseContext, Externalizable
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) |
public 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()
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 void setExpiration(long exprTime)
public int getSerialFormat()
Lease
getSerialFormat
in interface Lease
Lease.setSerialFormat(int)
public void setSerialFormat(int format)
Lease
setSerialFormat
in interface Lease
format
- 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 boolean canBatch(Lease lease)
Lease
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 String getUID()
LeaseContext
getUID
in interface LeaseContext
public void setUID(String uid)
public int getVersion()
LeaseContext
getVersion
in interface LeaseContext
public Object getObject()
LeaseContext
WriteModifiers.RETURN_PREV_ON_UPDATE
is used, otherwise null)getObject
in interface LeaseContext
public 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 Externalizable
IOException
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
IOException
ClassNotFoundException
Copyright © GigaSpaces.