Class ChangeExtension

java.lang.Object
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 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 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.