blob: c7e1aea168f4147bb7e4936823fe12eca85eead0 [file] [log] [blame]
Yuta HIGUCHI598e57e2014-06-16 21:19:01 -07001package net.onrc.onos.core.util.distributed;
2
3// TODO Should it extend Number?
4// TODO Only minimum set required for sequencer is defined now. Add CAS, etc.
5/**
6 * Distributed version of AtomicLong.
7 */
8public interface DistributedAtomicLong {
9
10 /**
11 * Gets the current value.
12 *
13 * @return current value
14 */
15 long get();
16
17 /**
18 * Atomically adds the given value to the current value.
19 *
20 * @param delta value to add
21 * @return updated value
22 */
23 long addAndGet(long delta);
24
25
26 /**
27 * Sets to the given value.
28 *
29 * @param newValue value to set.
30 */
31 public void set(long newValue);
32
33 /**
34 * Atomically adds one to the current value.
35 *
36 * @return updated value
37 */
38 public long incrementAndGet();
39}