public class DefaultAtomicCounter extends Synchronous<AsyncAtomicCounter> implements AtomicCounter
AtomicCounter backed by a AsyncAtomicCounter.DistributedPrimitive.Status, DistributedPrimitive.TypeDEFAULT_OPERATION_TIMEOUT_MILLIS, DEFAULT_OPERTATION_TIMEOUT_MILLIS| Constructor and Description |
|---|
DefaultAtomicCounter(AsyncAtomicCounter asyncCounter,
long operationTimeoutMillis) |
| Modifier and Type | Method and Description |
|---|---|
long |
addAndGet(long delta)
Atomically adds the given value to the current value.
|
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 |
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 |
getAndIncrement()
Atomically increment by one the current value.
|
long |
incrementAndGet()
Atomically increment by one the current value.
|
void |
set(long value)
Atomically sets the given value to the current value.
|
destroy, name, primitiveTypeclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitprimitiveTypeaddStatusChangeListener, applicationId, destroy, name, removeStatusChangeListener, statusChangeListenerspublic DefaultAtomicCounter(AsyncAtomicCounter asyncCounter, long operationTimeoutMillis)
public long incrementAndGet()
AtomicCounterincrementAndGet in interface AtomicCounterpublic long getAndIncrement()
AtomicCountergetAndIncrement in interface AtomicCounterpublic long getAndAdd(long delta)
AtomicCountergetAndAdd in interface AtomicCounterdelta - the value to addpublic long addAndGet(long delta)
AtomicCounteraddAndGet in interface AtomicCounterdelta - the value to addpublic void set(long value)
AtomicCounterset in interface AtomicCountervalue - the value to setpublic boolean compareAndSet(long expectedValue,
long updateValue)
AtomicCountercompareAndSet in interface AtomicCounterexpectedValue - the expected current value of the counterupdateValue - the new value to be setpublic long get()
AtomicCounterget in interface AtomicCounter