GigaSpaces XAP 9.7.2 API

com.j_spaces.core
Interface LeaseContext<T>

All Superinterfaces:
Lease

public interface LeaseContext<T>
extends Lease

LeaseContext is a return-value encapsulation of a write operation.

Using either IPojoSpace.write(Object, net.jini.core.transaction.Transaction, long) or IPojoSpace.write(Object, net.jini.core.transaction.Transaction, long, long, int) with the UpdateModifiers.UPDATE_OR_WRITE returns a LeaseContext according to UPDATE-OR-WRITE semantics. The update-or-write operation is atomic - either a write or an update is performed.

LeaseContext's getObject() returns:

 //first write
 LeaseContext lease = space.write((Object)o, null, 1000);
 lease.getUID(); //returns UID of written object
 lease.getOriginalObject(); //returns null on first write
 lease.renew(Lease.FOREVER);
 
 //second write - equivalent to update
 lease = space.write((Object)o, null, 1000);
 lease.getUID(); //returns UID of object
 lease.getOriginalObject(); //returns previous value (i.e. of previous write)
 try{
   lease.renew(Lease.FOREVER); 
 }catch(UnsupportedOperationException e) {
  //not a real lease - constructed by update.
 }
 
  

Version:
5.0
Author:
Lior Ben Yizhak

Field Summary
 
Fields inherited from interface net.jini.core.lease.Lease
ABSOLUTE, ANY, DURATION, FOREVER
 
Method Summary
 T getObject()
          returns the previous value associated with this update-or-write operation.
 String getUID()
          Returns UID of written Entry.
 int getVersion()
          Returns the version of written \ updated entry.
 
Methods inherited from interface net.jini.core.lease.Lease
canBatch, cancel, createLeaseMap, getExpiration, getSerialFormat, renew, setSerialFormat
 

Method Detail

getUID

String getUID()
Returns UID of written Entry.

Returns:
UID of written Entry.

getVersion

int getVersion()
Returns the version of written \ updated entry.

Returns:
version of written \ updated entry.
Since:
9.0.0

getObject

T getObject()
returns the previous value associated with this update-or-write operation.
  • previous value, on successful update (Only if WriteModifiers.RETURN_PREV_ON_UPDATE is used, otherwise null)

    Returns:
    the associated object.

  • GigaSpaces XAP 9.7.2 API

    Copyright © GigaSpaces.