Package org.onosproject.store.primitives
Class DefaultAtomicValue<V>
- java.lang.Object
- 
- org.onosproject.store.service.Synchronous<AsyncAtomicValue<V>>
- 
- org.onosproject.store.primitives.DefaultAtomicValue<V>
 
 
- 
- Type Parameters:
- V- value type
 - All Implemented Interfaces:
- AtomicValue<V>,- DistributedPrimitive
 
 public class DefaultAtomicValue<V> extends Synchronous<AsyncAtomicValue<V>> implements AtomicValue<V> Default implementation for aAtomicValuebacked by aAsyncAtomicValue.
- 
- 
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
 
- 
 - 
Constructor SummaryConstructors Constructor Description DefaultAtomicValue(AsyncAtomicValue<V> asyncValue, long operationTimeoutMillis)
 - 
Method SummaryAll Methods Instance Methods Concrete 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.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 class org.onosproject.store.service.Synchronousdestroy, name, primitiveType
 - 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface org.onosproject.store.service.AtomicValueprimitiveType
 - 
Methods inherited from interface org.onosproject.store.service.DistributedPrimitiveaddStatusChangeListener, applicationId, destroy, name, removeStatusChangeListener, statusChangeListeners
 
- 
 
- 
- 
- 
Constructor Detail- 
DefaultAtomicValuepublic DefaultAtomicValue(AsyncAtomicValue<V> asyncValue, long operationTimeoutMillis) 
 
- 
 - 
Method Detail- 
compareAndSetpublic boolean compareAndSet(V expect, V update) Description copied from interface:AtomicValueAtomically 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. - Specified by:
- compareAndSetin interface- AtomicValue<V>
- 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.
 
 - 
getpublic V get() Description copied from interface:AtomicValueGets the current value.- Specified by:
- getin interface- AtomicValue<V>
- Returns:
- current value
 
 - 
getAndSetpublic V getAndSet(V value) Description copied from interface:AtomicValueAtomically sets to the given value and returns the old value.- Specified by:
- getAndSetin interface- AtomicValue<V>
- Parameters:
- value- the new value
- Returns:
- previous value
 
 - 
setpublic void set(V value) Description copied from interface:AtomicValueSets to the given value.- Specified by:
- setin interface- AtomicValue<V>
- Parameters:
- value- new value
 
 - 
addListenerpublic void addListener(AtomicValueEventListener<V> listener) Description copied from interface:AtomicValueRegisters the specified listener to be notified whenever the atomic value is updated.- Specified by:
- addListenerin interface- AtomicValue<V>
- Parameters:
- listener- listener to notify about events
 
 - 
removeListenerpublic void removeListener(AtomicValueEventListener<V> listener) Description copied from interface:AtomicValueUnregisters the specified listener such that it will no longer receive atomic value update notifications.- Specified by:
- removeListenerin interface- AtomicValue<V>
- Parameters:
- listener- listener to unregister
 
 
- 
 
-