io.vertx.reactivex.core.shareddata

## Class Counter

- java.lang.Object
- - io.vertx.reactivex.core.shareddata.Counter

- All Implemented Interfaces:
    io.vertx.lang.rx.RxDelegate

      public class Counter
      extends Object
      implements io.vertx.lang.rx.RxDelegate

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

  NOTE: This class has been automatically generated from the `original` non RX-ified interface using Vert.x codegen.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static io.vertx.lang.rx.TypeArg<Counter>` | `__TYPE_ARG`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Counter(Counter delegate)`
    `Counter(Object delegate)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addAndGet(long value)` Add the value to the counter atomically and return the new count
    `void` | `addAndGet(long value, Handler<AsyncResult<Long>> resultHandler)` Add the value to the counter atomically and return the new count
    `void` | `compareAndSet(long expected, long value)` Set the counter to the specified value only if the current value is the expectec value.
    `void` | `compareAndSet(long expected, long value, Handler<AsyncResult<Boolean>> resultHandler)` Set the counter to the specified value only if the current value is the expectec value.
    `void` | `decrementAndGet()` Decrement the counter atomically and return the new count
    `void` | `decrementAndGet(Handler<AsyncResult<Long>> resultHandler)` Decrement the counter atomically and return the new count
    `boolean` | `equals(Object o)`
    `void` | `get()` Get the current value of the counter
    `void` | `get(Handler<AsyncResult<Long>> resultHandler)` Get the current value of the counter
    `void` | `getAndAdd(long value)` Add the value to the counter atomically and return the value before the add
    `void` | `getAndAdd(long value, Handler<AsyncResult<Long>> resultHandler)` Add the value to the counter atomically and return the value before the add
    `void` | `getAndIncrement()` Increment the counter atomically and return the value before the increment.
    `void` | `getAndIncrement(Handler<AsyncResult<Long>> resultHandler)` Increment the counter atomically and return the value before the increment.
    `Counter` | `getDelegate()`
    `int` | `hashCode()`
    `void` | `incrementAndGet()` Increment the counter atomically and return the new count
    `void` | `incrementAndGet(Handler<AsyncResult<Long>> resultHandler)` Increment the counter atomically and return the new count
    `static Counter` | `newInstance(Counter arg)`
    `Single<Long>` | `rxAddAndGet(long value)` Add the value to the counter atomically and return the new count
    `Single<Boolean>` | `rxCompareAndSet(long expected, long value)` Set the counter to the specified value only if the current value is the expectec value.
    `Single<Long>` | `rxDecrementAndGet()` Decrement the counter atomically and return the new count
    `Single<Long>` | `rxGet()` Get the current value of the counter
    `Single<Long>` | `rxGetAndAdd(long value)` Add the value to the counter atomically and return the value before the add
    `Single<Long>` | `rxGetAndIncrement()` Increment the counter atomically and return the value before the increment.
    `Single<Long>` | `rxIncrementAndGet()` Increment the counter atomically and return the new count
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### __TYPE_ARG

          public static final io.vertx.lang.rx.TypeArg<Counter> __TYPE_ARG

  - ### Constructor Detail

    - #### Counter

          public Counter(Counter delegate)

    - #### Counter

          public Counter(Object delegate)

  - ### Method Detail

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### getDelegate

          public Counter getDelegate()

      Specified by:
        `getDelegate` in interface `io.vertx.lang.rx.RxDelegate`

    - #### get

          public void get(Handler<AsyncResult<Long>> resultHandler)

      Get the current value of the counter
      Parameters:
        `resultHandler` - handler which will be passed the value

    - #### get

          public void get()

      Get the current value of the counter

    - #### rxGet

          public Single<Long> rxGet()

      Get the current value of the counter
      Returns:

    - #### incrementAndGet

          public void incrementAndGet(Handler<AsyncResult<Long>> resultHandler)

      Increment the counter atomically and return the new count
      Parameters:
        `resultHandler` - handler which will be passed the value

    - #### incrementAndGet

          public void incrementAndGet()

      Increment the counter atomically and return the new count

    - #### rxIncrementAndGet

          public Single<Long> rxIncrementAndGet()

      Increment the counter atomically and return the new count
      Returns:

    - #### getAndIncrement

          public void getAndIncrement(Handler<AsyncResult<Long>> resultHandler)

      Increment the counter atomically and return the value before the increment.
      Parameters:
        `resultHandler` - handler which will be passed the value

    - #### getAndIncrement

          public void getAndIncrement()

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

    - #### rxGetAndIncrement

          public Single<Long> rxGetAndIncrement()

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

    - #### decrementAndGet

          public void decrementAndGet(Handler<AsyncResult<Long>> resultHandler)

      Decrement the counter atomically and return the new count
      Parameters:
        `resultHandler` - handler which will be passed the value

    - #### decrementAndGet

          public void decrementAndGet()

      Decrement the counter atomically and return the new count

    - #### rxDecrementAndGet

          public Single<Long> rxDecrementAndGet()

      Decrement the counter atomically and return the new count
      Returns:

    - #### addAndGet

          public void addAndGet(long value,
                                Handler<AsyncResult<Long>> 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

    - #### addAndGet

          public void addAndGet(long value)

      Add the value to the counter atomically and return the new count
      Parameters:
        `value` - the value to add

    - #### rxAddAndGet

          public Single<Long> rxAddAndGet(long value)

      Add the value to the counter atomically and return the new count
      Parameters:
        `value` - the value to add
      Returns:

    - #### getAndAdd

          public void getAndAdd(long value,
                                Handler<AsyncResult<Long>> 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

    - #### getAndAdd

          public void getAndAdd(long value)

      Add the value to the counter atomically and return the value before the add
      Parameters:
        `value` - the value to add

    - #### rxGetAndAdd

          public Single<Long> rxGetAndAdd(long value)

      Add the value to the counter atomically and return the value before the add
      Parameters:
        `value` - the value to add
      Returns:

    - #### compareAndSet

          public void compareAndSet(long expected,
                                    long value,
                                    Handler<AsyncResult<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

    - #### compareAndSet

          public void compareAndSet(long expected,
                                    long value)

      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

    - #### rxCompareAndSet

          public Single<Boolean> rxCompareAndSet(long expected,
                                                 long value)

      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
      Returns:

    - #### newInstance

          public static Counter newInstance(Counter arg)

Copyright © 2025 Eclipse. All rights reserved.