Interface CounterDelegate
@Beta
public interface CounterDelegate
Gossip-based counter service.
-
Method Summary
Modifier and Type Method Description longaddAndGet(long delta)Atomically adds the given value to the current value.voidclose()Closes the counter.longdecrementAndGet()Atomically decrement by one and return the updated value.longget()Returns the counter value.longgetAndAdd(long delta)Atomically adds the given value to the current value.longgetAndDecrement()Atomically decrement by one and return the previous value.longgetAndIncrement()Atomically increment by one and return the previous value.longincrementAndGet()Atomically increment by one and return the updated value.
-
Method Details
-
incrementAndGet
long incrementAndGet()Atomically increment by one and return the updated value.- Returns:
- updated value
-
decrementAndGet
long decrementAndGet()Atomically decrement by one and return the updated value.- Returns:
- updated value
-
getAndIncrement
long getAndIncrement()Atomically increment by one and return the previous value.- Returns:
- previous value
-
getAndDecrement
long getAndDecrement()Atomically decrement by one and return the previous value.- Returns:
- previous value
-
getAndAdd
long getAndAdd(long delta)Atomically adds the given value to the current value.- Parameters:
delta- the value to add- Returns:
- previous value
-
addAndGet
long addAndGet(long delta)Atomically adds the given value to the current value.- Parameters:
delta- the value to add- Returns:
- updated value
-
get
long get()Returns the counter value.- Returns:
- the counter value
-
close
void close()Closes the counter.
-