Package com.yahoo.vespa.curator.recipes
Class CuratorCounter
java.lang.Object
com.yahoo.vespa.curator.recipes.CuratorCounter
A distributed atomic counter.
- Author:
- Ulf Lilleengen
-
Constructor Summary
-
Method Summary
-
Constructor Details
-
CuratorCounter
-
-
Method Details
-
next
public long next()Convenience method foradd(long)
with 1 -
previous
public long previous()Convenience method foradd(long)
with -1 -
add
public long add(long delta) Atomically add and return resulting value.- Parameters:
delta
- value to add, may be negative- Returns:
- the resulting value
- Throws:
IllegalStateException
- if addition fails
-
set
public void set(long current) -
get
public long get() -
initialize
public void initialize(long value) -
toString
-