Package org.onosproject.store.service
Interface AtomicValue<V>
- 
- Type Parameters:
- V- value type
 - All Superinterfaces:
- DistributedPrimitive
 - All Known Implementing Classes:
- DefaultAtomicValue
 
 public interface AtomicValue<V> extends DistributedPrimitive Distributed version of java.util.concurrent.atomic.AtomicReference.
- 
- 
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 voidaddListener(AtomicValueEventListener<V> listener)Registers the specified listener to be notified whenever the atomic value is updated.booleancompareAndSet(V expect, V update)Atomically sets the value to the given updated value if the current value is equal to the expected value.Vget()Gets the current value.VgetAndSet(V value)Atomically sets to the given value and returns the old value.default DistributedPrimitive.TypeprimitiveType()Returns the type of primitive.voidremoveListener(AtomicValueEventListener<V> listener)Unregisters the specified listener such that it will no longer receive atomic value update notifications.voidset(V value)Sets to the given 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
 
 - 
compareAndSetboolean compareAndSet(V expect, V update) Atomically sets the value to the given updated value if the current value is equal to the expected value.IMPORTANT: Equality is based on the equality of the serialized byte[] representations. - Parameters:
- expect- the expected value
- update- the new value
- Returns:
- true if successful. false return indicates that the actual value was not equal to the expected value.
 
 - 
getV get() Gets the current value.- Returns:
- current value
 
 - 
getAndSetV getAndSet(V value) Atomically sets to the given value and returns the old value.- Parameters:
- value- the new value
- Returns:
- previous value
 
 - 
setvoid set(V value) Sets to the given value.- Parameters:
- value- new value
 
 - 
addListenervoid addListener(AtomicValueEventListener<V> listener) Registers the specified listener to be notified whenever the atomic value is updated.- Parameters:
- listener- listener to notify about events
 
 - 
removeListenervoid removeListener(AtomicValueEventListener<V> listener) Unregisters the specified listener such that it will no longer receive atomic value update notifications.- Parameters:
- listener- listener to unregister
 
 
- 
 
-