public interface AtomicCounter extends SyncPrimitive
DEFAULT_OPERATION_TIMEOUT_MILLIS| Modifier and Type | Method and Description |
|---|---|
long |
addAndGet(long delta)
Atomically adds the given value to the current value.
|
AsyncAtomicCounter |
async()
Returns the underlying asynchronous primitive.
|
boolean |
compareAndSet(long expectedValue,
long updateValue)
Atomically sets the given counter to the updated value if the current value is the expected value, otherwise
no change occurs.
|
long |
decrementAndGet()
Atomically decrement by one and return the updated value.
|
long |
get()
Returns the current value of the counter without modifying it.
|
long |
getAndAdd(long delta)
Atomically adds the given value to the current value.
|
long |
getAndDecrement()
Atomically decrement by one and return the previous value.
|
long |
getAndIncrement()
Atomically increment by one and return the previous value.
|
long |
incrementAndGet()
Atomically increment by one and return the updated value.
|
void |
set(long value)
Atomically sets the given value to the current value.
|
close, deleteaddStateChangeListener, name, protocol, removeStateChangeListener, typelong incrementAndGet()
long decrementAndGet()
long getAndIncrement()
long getAndDecrement()
long getAndAdd(long delta)
delta - the value to addlong addAndGet(long delta)
delta - the value to addvoid set(long value)
value - the value to setboolean compareAndSet(long expectedValue,
long updateValue)
expectedValue - the expected current value of the counterupdateValue - the new value to be setlong get()
AsyncAtomicCounter async()
SyncPrimitiveasync in interface SyncPrimitiveCopyright © 2013–2018. All rights reserved.