Package com.j_spaces.core
Class LeaseProxy
java.lang.Object
com.j_spaces.core.LeaseProxy
- All Implemented Interfaces:
SmartExternalizable,LeaseContext,Externalizable,Serializable,Lease
An instance of this class represents an entry/template lease or a lease of an event registration
results from an event registration.
You can get entry UID from the entry Lease object. e.g.
You can get entry UID from the entry Lease object. e.g.
Message o = new Message ("A");
Lease lease = space.write(o, null, Lease.FOREVER);
LeaseProxy lp = (LeaseProxy) lease;
String uid = lp.getUID();
- Version:
- 1.0
- Author:
- Igor Goldenberg
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionRequired forExternalizable.LeaseProxy(long expirationTime, String uid, String classname, int version, int objectType) LeaseProxy(long expirationTime, String uid, String classname, int version, int objectType, SpaceImpl spaceImpl) protectedLeaseProxy(LeaseProxy lease) -
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.voidcancel()Used by the lease holder to indicate that it is no longer interested in the resource or information held by the 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 a class name of lease resource( Entry/Notify Template ).longReturns alongthat indicates the time that the lease will expire.returns the previous value associated with this update-or-write operation.intintReturns the format that will be used to serialize the lease.getSpace()getUID()Returns UID of written Entry.intReturns the version of written \ updated entry.voidvoidrenew(long duration) Used to renew a lease for an additional period of time, specified in milliseconds.voidsetExpiration(long exprTime) voidvoidsetRemoteSpace(IRemoteSpace remoteSpace) voidsetSerialFormat(int format) Sets the format to use when serializing the lease.voidvoidMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.gigaspaces.serialization.SmartExternalizable
enabledSmartExternalizableWithReference
-
Field Details
-
_expirationTime
protected long _expirationTime
-
-
Constructor Details
-
LeaseProxy
public LeaseProxy()Required forExternalizable. -
LeaseProxy
-
LeaseProxy
-
LeaseProxy
-
-
Method Details
-
getExpiration
public long getExpiration()Description copied from interface:LeaseReturns alongthat 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.- Specified by:
getExpirationin interfaceLease- Returns:
- a
longthat indicates the time that the lease will expire
-
setExpiration
public void setExpiration(long exprTime) -
getSerialFormat
public int getSerialFormat()Description copied from interface:LeaseReturns the format that will be used to serialize the lease.- Specified by:
getSerialFormatin interfaceLease- Returns:
- an int representing the serial format value
- See Also:
-
setSerialFormat
public void setSerialFormat(int format) Description copied from interface:LeaseSets the format to use when serializing the lease.- Specified by:
setSerialFormatin interfaceLease- Parameters:
format- DURATION or ABSOLUTE- See Also:
-
cancel
Description copied from interface:LeaseUsed by the lease holder to indicate that it is no longer interested in the resource or information held by the lease. If the leased information or resource could cause a callback to the lease holder (or some other object on behalf of the lease holder), the lease grantor should not issue such a callback after the lease has been cancelled. The overall effect of a cancel call is the same as lease expiration, but instead of happening at the end of a pre-agreed duration it happens immediately.- Specified by:
cancelin interfaceLease- Throws:
UnknownLeaseException- the lease being cancelled is unknown to the lease grantorRemoteException
-
renew
public void renew(long duration) throws LeaseDeniedException, UnknownLeaseException, RemoteException Description copied from interface:LeaseUsed to renew a lease for an additional period of time, specified in milliseconds. This duration is not added to the original lease, but is used to determine a new expiration time for the existing lease. If the renewal is granted this is reflected in value returned by getExpiration. If the renewal fails, the lease is left intact for the same duration that was in force prior to the call to renew.- Specified by:
renewin interfaceLease- Parameters:
duration- the requested duration in milliseconds- Throws:
LeaseDeniedException- the lease grantor is unable or unwilling to renew the leaseUnknownLeaseException- the lease being renewed is unknown to the lease grantorRemoteException
-
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. -
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- 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
-
getUID
Description copied from interface:LeaseContextReturns UID of written Entry.- Specified by:
getUIDin interfaceLeaseContext- Returns:
- UID of written Entry.
-
setUID
-
getVersion
public int getVersion()Description copied from interface:LeaseContextReturns the version of written \ updated entry.- Specified by:
getVersionin interfaceLeaseContext- Returns:
- version of written \ updated entry.
-
getObject
Description copied from interface:LeaseContextreturns the previous value associated with this update-or-write operation.- null, on a successful write
- previous value, on successful update (Only if
WriteModifiers.RETURN_PREV_ON_UPDATEis used, otherwise null)- Specified by:
getObjectin interfaceLeaseContext- Returns:
- the associated object.
-
setObject
-
getObjectType
public int getObjectType() -
getClassname
Returns a class name of lease resource( Entry/Notify Template ). Only if and only if the space is persistent.- Returns:
- Returns class name of lease resource( Entry/Notify Template ).
-
getSpace
-
setRemoteSpace
-
writeExternal
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
readExternal
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOExceptionClassNotFoundException
-