Class SpaceUtil

java.lang.Object
org.jpos.space.SpaceUtil

public class SpaceUtil extends Object
Space related helper methods
Since:
1.4.7
  • Constructor Details

    • SpaceUtil

      public SpaceUtil()
      Default constructor; no instance state to initialise.
  • Method Details

    • inpAll

      public static Object[] inpAll(Space sp, Object key)
      return all entries under a given key
      Parameters:
      sp - the Space
      key - Entry's key
      Returns:
      array containing all entries under key
    • wipe

      public static void wipe(Space sp, Object key)
      Remove all entries under key
      Parameters:
      sp - the Space
      key - Entry's key
    • wipeAndOut

      @Deprecated public static void wipeAndOut(Space sp, Object key, Object value)
      Deprecated.
      Use space.put instead
      Parameters:
      sp - the Space
      key - entry's key
      value - entry's value
    • wipeAndOut

      @Deprecated public static void wipeAndOut(Space sp, Object key, Object value, long timeout)
      Deprecated.
      use space.put instead
      Parameters:
      sp - the Space
      key - entry's key
      value - entry's value
      timeout - entry lifespan in milliseconds
    • nextLong

      public static long nextLong(Space sp, Object key)
      Atomically increments and returns the long counter stored under key.
      Parameters:
      sp - the Space
      key - counter's key
      Returns:
      the new counter value
    • outIfEmpty

      public static boolean outIfEmpty(Space sp, Object key, Object value, long nrdTimeout, long outTimeout)
      Writes value only when the slot at key is empty after an nrd probe.
      Parameters:
      sp - the Space
      key - entry's key
      value - entry's value
      nrdTimeout - how long nrd waits for the slot to become non-empty
      outTimeout - entry lifespan once written
      Returns:
      true if the value was written, false if the slot was already populated
    • outWhenEmpty

      public static void outWhenEmpty(Space sp, Object key, Object value, long timeout)
      Blocks until the slot at key is empty, then writes value with the given lifespan.
      Parameters:
      sp - the Space
      key - entry's key
      value - entry's value
      timeout - entry lifespan once written
    • outWhenEmpty

      public static void outWhenEmpty(Space sp, Object key, Object value)
      Blocks until the slot at key is empty, then writes value.
      Parameters:
      sp - the Space
      key - entry's key
      value - entry's value