An asynchronous counter that can be used to across the cluster to maintain a consistent count.
Constructor and description |
---|
Counter
(java.lang.Object delegate) |
Type | Name and description |
---|---|
void |
addAndGet(long value, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Long>> resultHandler) Add the value to the counter atomically and return the new count |
void |
compareAndSet(long expected, long value, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Boolean>> resultHandler) Set the counter to the specified value only if the current value is the expectec value. |
void |
decrementAndGet(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Long>> resultHandler) Decrement the counter atomically and return the new count |
void |
get(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Long>> resultHandler) Get the current value of the counter |
void |
getAndAdd(long value, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Long>> resultHandler) Add the value to the counter atomically and return the value before the add |
void |
getAndIncrement(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Long>> resultHandler) Increment the counter atomically and return the value before the increment. |
java.lang.Object |
getDelegate() |
void |
incrementAndGet(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Long>> resultHandler) Increment the counter atomically and return the new count |
Methods inherited from class | Name |
---|---|
class java.lang.Object |
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Add the value to the counter atomically and return the new count
value
- the value to addresultHandler
- handler which will be passed the valueSet the counter to the specified value only if the current value is the expectec value. This happens atomically.
expected
- the expected valuevalue
- the new valueresultHandler
- the handler will be passed true on successDecrement the counter atomically and return the new count
resultHandler
- handler which will be passed the valueGet the current value of the counter
resultHandler
- handler which will be passed the valueAdd the value to the counter atomically and return the value before the add
value
- the value to addresultHandler
- handler which will be passed the valueIncrement the counter atomically and return the value before the increment.
resultHandler
- handler which will be passed the valueIncrement the counter atomically and return the new count
resultHandler
- handler which will be passed the value