public interface AtomicCounter extends DistributedPrimitive
DistributedPrimitive.Status, DistributedPrimitive.Type
DEFAULT_OPERATION_TIMEOUT_MILLIS, DEFAULT_OPERTATION_TIMEOUT_MILLIS
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.
|
default DistributedPrimitive.Type |
primitiveType()
Returns the type of primitive.
|
void |
set(long value)
Atomically sets the given value to the current value.
|
addStatusChangeListener, applicationId, destroy, name, removeStatusChangeListener, statusChangeListeners
default DistributedPrimitive.Type primitiveType()
DistributedPrimitive
primitiveType
in interface DistributedPrimitive
long incrementAndGet()
long getAndIncrement()
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()