An asynchronous counter that can be used to across the cluster to maintain a consistent count.

  • Counter
    • Basic
      • Identifiable
      • Object
        • Anything

no subtypes hierarchy

Initializer
Counter(Counter unknown)
Inherited Attributes
Attributes inherited from: Object
hash, string
Methods
addAndGetshared default void addAndGet(Integer value, Anything(Throwable|Integer) resultHandler)

Add the value to the counter atomically and return the new count

Parameters:
  • value

    the value to add

  • resultHandler

    handler which will be passed the value

compareAndSetshared default void compareAndSet(Integer expected, Integer value, Anything(Throwable|Boolean) resultHandler)

Set the counter to the specified value only if the current value is the expectec value. This happens atomically.

Parameters:
  • expected

    the expected value

  • value

    the new value

  • resultHandler

    the handler will be passed true on success

decrementAndGetshared default void decrementAndGet(Anything(Throwable|Integer) resultHandler)

Decrement the counter atomically and return the new count

Parameters:
  • resultHandler

    handler which will be passed the value

getshared default void get(Anything(Throwable|Integer) resultHandler)

Get the current value of the counter

Parameters:
  • resultHandler

    handler which will be passed the value

getAndAddshared default void getAndAdd(Integer value, Anything(Throwable|Integer) resultHandler)

Add the value to the counter atomically and return the value before the add

Parameters:
  • value

    the value to add

  • resultHandler

    handler which will be passed the value

getAndIncrementshared default void getAndIncrement(Anything(Throwable|Integer) resultHandler)

Increment the counter atomically and return the value before the increment.

Parameters:
  • resultHandler

    handler which will be passed the value

incrementAndGetshared default void incrementAndGet(Anything(Throwable|Integer) resultHandler)

Increment the counter atomically and return the new count

Parameters:
  • resultHandler

    handler which will be passed the value

Inherited Methods
Methods inherited from: Object
equals