Package org.openspaces.extensions
Class ChangeExtension
java.lang.Object
org.openspaces.extensions.ChangeExtension
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T,D extends Number>
DAtomically adds the given value to the current value of an entry's property.static <T,D extends Number>
DaddAndGet(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,D extends Number>
DaddAndGet(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> TgetSingleChangeOperationResult(ChangeResult<?> changeResult) Gets the result of a single change operation which that was applied on a single entry, otherwise an exception will be thrown.
-
Constructor Details
-
ChangeExtension
public ChangeExtension()
-
-
Method Details
-
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
NullPointerExceptionif 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
NullPointerExceptionif 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
NullPointerExceptionif no entry was found.
-
getSingleChangeOperationResult
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.
-