public interface Counter
Modifier and Type | Method and Description |
---|---|
Future<Long> |
addAndGet(long value)
Same as
addAndGet(long, Handler) but returns a Future of the asynchronous result |
default void |
addAndGet(long value,
Handler<AsyncResult<Long>> resultHandler)
Add the value to the counter atomically and return the new count
|
Future<Boolean> |
compareAndSet(long expected,
long value)
Same as
compareAndSet(long, long, Handler) but returns a Future of the asynchronous result |
default 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.
|
Future<Long> |
decrementAndGet()
Same as
decrementAndGet(Handler) but returns a Future of the asynchronous result |
default void |
decrementAndGet(Handler<AsyncResult<Long>> resultHandler)
Decrement the counter atomically and return the new count
|
Future<Long> |
get()
Same as
get(Handler) but returns a Future of the asynchronous result |
default void |
get(Handler<AsyncResult<Long>> resultHandler)
Get the current value of the counter
|
Future<Long> |
getAndAdd(long value)
Same as
getAndAdd(long, Handler) but returns a Future of the asynchronous result |
default void |
getAndAdd(long value,
Handler<AsyncResult<Long>> resultHandler)
Add the value to the counter atomically and return the value before the add
|
Future<Long> |
getAndIncrement()
Same as
getAndIncrement(Handler) but returns a Future of the asynchronous result |
default void |
getAndIncrement(Handler<AsyncResult<Long>> resultHandler)
Increment the counter atomically and return the value before the increment.
|
Future<Long> |
incrementAndGet()
Same as
incrementAndGet(Handler) but returns a Future of the asynchronous result |
default void |
incrementAndGet(Handler<AsyncResult<Long>> resultHandler)
Increment the counter atomically and return the new count
|
default void get(Handler<AsyncResult<Long>> resultHandler)
resultHandler
- handler which will be passed the valueFuture<Long> get()
get(Handler)
but returns a Future
of the asynchronous resultdefault void incrementAndGet(Handler<AsyncResult<Long>> resultHandler)
resultHandler
- handler which will be passed the valueFuture<Long> incrementAndGet()
incrementAndGet(Handler)
but returns a Future
of the asynchronous resultdefault void getAndIncrement(Handler<AsyncResult<Long>> resultHandler)
resultHandler
- handler which will be passed the valueFuture<Long> getAndIncrement()
getAndIncrement(Handler)
but returns a Future
of the asynchronous resultdefault void decrementAndGet(Handler<AsyncResult<Long>> resultHandler)
resultHandler
- handler which will be passed the valueFuture<Long> decrementAndGet()
decrementAndGet(Handler)
but returns a Future
of the asynchronous resultdefault void addAndGet(long value, Handler<AsyncResult<Long>> resultHandler)
value
- the value to addresultHandler
- handler which will be passed the valueFuture<Long> addAndGet(long value)
addAndGet(long, Handler)
but returns a Future
of the asynchronous resultdefault void getAndAdd(long value, Handler<AsyncResult<Long>> resultHandler)
value
- the value to addresultHandler
- handler which will be passed the valueFuture<Long> getAndAdd(long value)
getAndAdd(long, Handler)
but returns a Future
of the asynchronous resultdefault void compareAndSet(long expected, long value, Handler<AsyncResult<Boolean>> resultHandler)
expected
- the expected valuevalue
- the new valueresultHandler
- the handler will be passed true on successFuture<Boolean> compareAndSet(long expected, long value)
compareAndSet(long, long, Handler)
but returns a Future
of the asynchronous resultCopyright © 2024 Eclipse. All rights reserved.