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 Summary

      Constructors 
      Constructor Description
      Counter​(io.vertx.core.shareddata.Counter delegate)  
      Counter​(Object delegate)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addAndGet​(long value)
      Add the value to the counter atomically and return the new count
      void addAndGet​(long value, io.vertx.core.Handler<io.vertx.core.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, io.vertx.core.Handler<io.vertx.core.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​(io.vertx.core.Handler<io.vertx.core.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​(io.vertx.core.Handler<io.vertx.core.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, io.vertx.core.Handler<io.vertx.core.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​(io.vertx.core.Handler<io.vertx.core.AsyncResult<Long>> resultHandler)
      Increment the counter atomically and return the value before the increment.
      io.vertx.core.shareddata.Counter getDelegate()  
      int hashCode()  
      void incrementAndGet()
      Increment the counter atomically and return the new count
      void incrementAndGet​(io.vertx.core.Handler<io.vertx.core.AsyncResult<Long>> resultHandler)
      Increment the counter atomically and return the new count
      static Counter newInstance​(io.vertx.core.shareddata.Counter arg)  
      rx.Single<Long> rxAddAndGet​(long value)
      Add the value to the counter atomically and return the new count
      rx.Single<Boolean> rxCompareAndSet​(long expected, long value)
      Set the counter to the specified value only if the current value is the expectec value.
      rx.Single<Long> rxDecrementAndGet()
      Decrement the counter atomically and return the new count
      rx.Single<Long> rxGet()
      Get the current value of the counter
      rx.Single<Long> rxGetAndAdd​(long value)
      Add the value to the counter atomically and return the value before the add
      rx.Single<Long> rxGetAndIncrement()
      Increment the counter atomically and return the value before the increment.
      rx.Single<Long> rxIncrementAndGet()
      Increment the counter atomically and return the new count
      String toString()  
    • Constructor Detail

      • Counter

        public Counter​(io.vertx.core.shareddata.Counter delegate)
      • Counter

        public Counter​(Object delegate)
    • Method Detail

      • hashCode

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

        public io.vertx.core.shareddata.Counter getDelegate()
      • get

        public void get​(io.vertx.core.Handler<io.vertx.core.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 rx.Single<Long> rxGet()
        Get the current value of the counter
        Returns:
      • incrementAndGet

        public void incrementAndGet​(io.vertx.core.Handler<io.vertx.core.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 rx.Single<Long> rxIncrementAndGet()
        Increment the counter atomically and return the new count
        Returns:
      • getAndIncrement

        public void getAndIncrement​(io.vertx.core.Handler<io.vertx.core.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 rx.Single<Long> rxGetAndIncrement()
        Increment the counter atomically and return the value before the increment.
        Returns:
      • decrementAndGet

        public void decrementAndGet​(io.vertx.core.Handler<io.vertx.core.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 rx.Single<Long> rxDecrementAndGet()
        Decrement the counter atomically and return the new count
        Returns:
      • addAndGet

        public void addAndGet​(long value,
                              io.vertx.core.Handler<io.vertx.core.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 rx.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,
                              io.vertx.core.Handler<io.vertx.core.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 rx.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,
                                  io.vertx.core.Handler<io.vertx.core.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 rx.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​(io.vertx.core.shareddata.Counter arg)