Package org.onosproject.store.service
Interface AsyncAtomicCounter
- 
- All Superinterfaces:
 DistributedPrimitive
public interface AsyncAtomicCounter extends DistributedPrimitive
An async atomic counter dispenses monotonically increasing values. 
- 
- 
Nested Class Summary
- 
Nested classes/interfaces inherited from interface org.onosproject.store.service.DistributedPrimitive
DistributedPrimitive.Status, DistributedPrimitive.Type 
 - 
 
- 
Field Summary
- 
Fields inherited from interface org.onosproject.store.service.DistributedPrimitive
DEFAULT_OPERATION_TIMEOUT_MILLIS 
 - 
 
- 
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description java.util.concurrent.CompletableFuture<java.lang.Long>addAndGet(long delta)Atomically adds the given value to the current value.default AtomicCounterasAtomicCounter()Returns a newAtomicCounterthat is backed by this instance and with a default operation timeout.default AtomicCounterasAtomicCounter(long timeoutMillis)Returns a newAtomicCounterthat is backed by this instance.java.util.concurrent.CompletableFuture<java.lang.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.java.util.concurrent.CompletableFuture<java.lang.Long>get()Returns the current value of the counter without modifying it.java.util.concurrent.CompletableFuture<java.lang.Long>getAndAdd(long delta)Atomically adds the given value to the current value.java.util.concurrent.CompletableFuture<java.lang.Long>getAndIncrement()Atomically increment by one the current value.java.util.concurrent.CompletableFuture<java.lang.Long>incrementAndGet()Atomically increment by one the current value.default DistributedPrimitive.TypeprimitiveType()Returns the type of primitive.java.util.concurrent.CompletableFuture<java.lang.Void>set(long value)Atomically sets the given value to the current value.- 
Methods inherited from interface org.onosproject.store.service.DistributedPrimitive
addStatusChangeListener, applicationId, destroy, name, removeStatusChangeListener, statusChangeListeners 
 - 
 
 - 
 
- 
- 
Method Detail
- 
primitiveType
default DistributedPrimitive.Type primitiveType()
Description copied from interface:DistributedPrimitiveReturns the type of primitive.- Specified by:
 primitiveTypein interfaceDistributedPrimitive- Returns:
 - primitive type
 
 
- 
incrementAndGet
java.util.concurrent.CompletableFuture<java.lang.Long> incrementAndGet()
Atomically increment by one the current value.- Returns:
 - updated value
 
 
- 
getAndIncrement
java.util.concurrent.CompletableFuture<java.lang.Long> getAndIncrement()
Atomically increment by one the current value.- Returns:
 - previous value
 
 
- 
getAndAdd
java.util.concurrent.CompletableFuture<java.lang.Long> getAndAdd(long delta)
Atomically adds the given value to the current value.- Parameters:
 delta- the value to add- Returns:
 - previous value
 
 
- 
addAndGet
java.util.concurrent.CompletableFuture<java.lang.Long> addAndGet(long delta)
Atomically adds the given value to the current value.- Parameters:
 delta- the value to add- Returns:
 - updated value
 
 
- 
get
java.util.concurrent.CompletableFuture<java.lang.Long> get()
Returns the current value of the counter without modifying it.- Returns:
 - current value
 
 
- 
set
java.util.concurrent.CompletableFuture<java.lang.Void> set(long value)
Atomically sets the given value to the current value.- Parameters:
 value- new value- Returns:
 - future void
 
 
- 
compareAndSet
java.util.concurrent.CompletableFuture<java.lang.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.- Parameters:
 expectedValue- the expected current value of the counterupdateValue- the new value to be set- Returns:
 - true if the update occurred and the expected value was equal to the current value, false otherwise
 
 
- 
asAtomicCounter
default AtomicCounter asAtomicCounter(long timeoutMillis)
Returns a newAtomicCounterthat is backed by this instance.- Parameters:
 timeoutMillis- timeout duration for the returned ConsistentMap operations- Returns:
 - new 
ConsistentMapinstance 
 
- 
asAtomicCounter
default AtomicCounter asAtomicCounter()
Returns a newAtomicCounterthat is backed by this instance and with a default operation timeout.- Returns:
 - new 
ConsistentMapinstance 
 
 - 
 
 -