Class Counter


  • public class Counter
    extends Object
    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.

    • Constructor Detail

      • Counter

        public Counter​(Counter delegate)
      • Counter

        public Counter​(Object delegate)
    • Method Detail

      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • getDelegate

        public Counter getDelegate()
      • 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 io.reactivex.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 io.reactivex.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 io.reactivex.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 io.reactivex.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 io.reactivex.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 io.reactivex.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 io.reactivex.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: