GigaSpaces XAP 10.0.1 API

org.openspaces.extensions
Class ChangeExtension

java.lang.Object
  extended by org.openspaces.extensions.ChangeExtension

public class ChangeExtension
extends Object

Extensions for the GigaSpace.change(com.gigaspaces.query.ISpaceQuery, ChangeSet, ChangeModifiers, long) API which simplify common usage patterns.

Since:
9.7
Author:
eitany

Constructor Summary
ChangeExtension()
           
 
Method Summary
static
<T,D extends Number>
D
addAndGet(GigaSpace gigaSpace, IdQuery<T> idQuery, String path, D delta)
          Atomically adds the given value to the current value of an entry's property.
static
<T,D extends Number>
D
addAndGet(GigaSpace gigaSpace, IdQuery<T> idQuery, String path, D delta, ChangeModifiers modifiers, long timeout, TimeUnit timeUnit)
          Atomically adds the given value to the current value of an entry's property.
static
<T,D extends Number>
D
addAndGet(GigaSpace gigaSpace, IdQuery<T> idQuery, String path, D delta, long timeout, TimeUnit timeUnit)
          Atomically adds the given value to the current value of an entry's property.
static
<T> T
getSingleChangeOperationResult(ChangeResult<?> changeResult)
          Gets the result of a single change operation which that was applied on a single entry, otherwise an exception will be thrown.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChangeExtension

public ChangeExtension()
Method Detail

addAndGet

public static <T,D extends Number> D addAndGet(GigaSpace gigaSpace,
                                               IdQuery<T> idQuery,
                                               String path,
                                               D delta)
Atomically adds the given value to the current value of an entry's property.

Parameters:
gigaSpace - the gigaspace which stores the entry.
idQuery - id the query which is used to locate the entry.
path - the path to the number property which is being modified.
delta - the value to add.
Returns:
the updated value, null of no matching entry found for the given id query. Therefore you must used the primitive wrapper types as the result value (e.g. Integer/Long) otherwise you may get NullPointerException if no entry was found.

addAndGet

public static <T,D extends Number> D addAndGet(GigaSpace gigaSpace,
                                               IdQuery<T> idQuery,
                                               String path,
                                               D delta,
                                               long timeout,
                                               TimeUnit timeUnit)
Atomically adds the given value to the current value of an entry's property.

Parameters:
gigaSpace - the gigaspace which stores the entry.
idQuery - id the query which is used to locate the entry.
path - the path to the number property which is being modified.
delta - the value to add.
timeout - time to wait if the entry is locked under a transaction.
timeUnit - units for the timeout.
Returns:
the updated value, null of no matching entry found for the given id query. Therefore you must use the primitive wrapper types as the result value (e.g. Integer/Long) otherwise you may get NullPointerException if no entry was found.

addAndGet

public static <T,D extends Number> D addAndGet(GigaSpace gigaSpace,
                                               IdQuery<T> idQuery,
                                               String path,
                                               D delta,
                                               ChangeModifiers modifiers,
                                               long timeout,
                                               TimeUnit timeUnit)
Atomically adds the given value to the current value of an entry's property.

Parameters:
gigaSpace - the gigaspace which stores the entry.
idQuery - id the query which is used to locate the entry.
path - the path to the number property which is being modified.
delta - the value to add.
modifiers - the change modifiers to use.
timeout - time to wait if the entry is locked under a transaction.
timeUnit - units for the timeout.
Returns:
the updated value, null of no matching entry found for the given id query. Therefore you must use the primitive wrapper types as the result value (e.g. Integer/Long) otherwise you may get NullPointerException if no entry was found.

getSingleChangeOperationResult

public static <T> T getSingleChangeOperationResult(ChangeResult<?> changeResult)
Gets the result of a single change operation which that was applied on a single entry, otherwise an exception will be thrown.

Parameters:
changeResult - the result of the change operation
Returns:
the result of a single change operation which that was applied on a single entry, otherwise an exception will be thrown. Or null if no entry was changed.

GigaSpaces XAP 10.0.1 API

Copyright © GigaSpaces.