diff options
Diffstat (limited to 'framework/src/onos/core/api/src/main/java/org/onosproject/store/service/AtomicCounter.java')
-rw-r--r-- | framework/src/onos/core/api/src/main/java/org/onosproject/store/service/AtomicCounter.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/store/service/AtomicCounter.java b/framework/src/onos/core/api/src/main/java/org/onosproject/store/service/AtomicCounter.java index f620e082..3c9e02c8 100644 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/store/service/AtomicCounter.java +++ b/framework/src/onos/core/api/src/main/java/org/onosproject/store/service/AtomicCounter.java @@ -51,6 +51,22 @@ public interface AtomicCounter { long addAndGet(long delta); /** + * Atomically sets the given value to the current value. + * + * @param value the value to set + */ + void set(long value); + + /** + * Atomically sets the given counter to the updated value if the current value is the expected value, otherwise + * no change occurs. + * @param expectedValue the expected current value of the counter + * @param updateValue the new value to be set + * @return true if the update occurred and the expected value was equal to the current value, false otherwise + */ + boolean compareAndSet(long expectedValue, long updateValue); + + /** * Returns the current value of the counter without modifying it. * * @return current value |