Package org.onosproject.store.service
Interface AtomicCounter
- 
- All Superinterfaces:
- DistributedPrimitive
 - All Known Implementing Classes:
- DefaultAtomicCounter
 
 public interface AtomicCounter extends DistributedPrimitive Distributed version of java.util.concurrent.atomic.AtomicLong.
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from interface org.onosproject.store.service.DistributedPrimitiveDistributedPrimitive.Status, DistributedPrimitive.Type
 
- 
 - 
Field Summary- 
Fields inherited from interface org.onosproject.store.service.DistributedPrimitiveDEFAULT_OPERATION_TIMEOUT_MILLIS
 
- 
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description longaddAndGet(long delta)Atomically adds the given value to the current value.booleancompareAndSet(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.longget()Returns the current value of the counter without modifying it.longgetAndAdd(long delta)Atomically adds the given value to the current value.longgetAndIncrement()Atomically increment by one the current value.longincrementAndGet()Atomically increment by one the current value.default DistributedPrimitive.TypeprimitiveType()Returns the type of primitive.voidset(long value)Atomically sets the given value to the current value.- 
Methods inherited from interface org.onosproject.store.service.DistributedPrimitiveaddStatusChangeListener, applicationId, destroy, name, removeStatusChangeListener, statusChangeListeners
 
- 
 
- 
- 
- 
Method Detail- 
primitiveTypedefault DistributedPrimitive.Type primitiveType() Description copied from interface:DistributedPrimitiveReturns the type of primitive.- Specified by:
- primitiveTypein interface- DistributedPrimitive
- Returns:
- primitive type
 
 - 
incrementAndGetlong incrementAndGet() Atomically increment by one the current value.- Returns:
- updated value
 
 - 
getAndIncrementlong getAndIncrement() Atomically increment by one the current value.- Returns:
- previous value
 
 - 
getAndAddlong getAndAdd(long delta) Atomically adds the given value to the current value.- Parameters:
- delta- the value to add
- Returns:
- previous value
 
 - 
addAndGetlong addAndGet(long delta) Atomically adds the given value to the current value.- Parameters:
- delta- the value to add
- Returns:
- updated value
 
 - 
setvoid set(long value) Atomically sets the given value to the current value.- Parameters:
- value- the value to set
 
 - 
compareAndSetboolean 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 counter
- updateValue- the new value to be set
- Returns:
- true if the update occurred and the expected value was equal to the current value, false otherwise
 
 - 
getlong get() Returns the current value of the counter without modifying it.- Returns:
- current value
 
 
- 
 
-