Class Counter
- java.lang.Object
-
- io.vertx.reactivex.core.shareddata.Counter
-
-
Field Summary
Fields Modifier and Type Field Description static TypeArg<Counter>
__TYPE_ARG
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAndGet(long value)
Add the value to the counter atomically and return the new countvoid
addAndGet(long value, Handler<AsyncResult<Long>> resultHandler)
Add the value to the counter atomically and return the new countvoid
compareAndSet(long expected, long value)
Set the counter to the specified value only if the current value is the expectec value.void
compareAndSet(long expected, long value, Handler<AsyncResult<Boolean>> resultHandler)
Set the counter to the specified value only if the current value is the expectec value.void
decrementAndGet()
Decrement the counter atomically and return the new countvoid
decrementAndGet(Handler<AsyncResult<Long>> resultHandler)
Decrement the counter atomically and return the new countboolean
equals(Object o)
void
get()
Get the current value of the countervoid
get(Handler<AsyncResult<Long>> resultHandler)
Get the current value of the countervoid
getAndAdd(long value)
Add the value to the counter atomically and return the value before the addvoid
getAndAdd(long value, Handler<AsyncResult<Long>> resultHandler)
Add the value to the counter atomically and return the value before the addvoid
getAndIncrement()
Increment the counter atomically and return the value before the increment.void
getAndIncrement(Handler<AsyncResult<Long>> resultHandler)
Increment the counter atomically and return the value before the increment.Counter
getDelegate()
int
hashCode()
void
incrementAndGet()
Increment the counter atomically and return the new countvoid
incrementAndGet(Handler<AsyncResult<Long>> resultHandler)
Increment the counter atomically and return the new countstatic Counter
newInstance(Counter arg)
io.reactivex.Single<Long>
rxAddAndGet(long value)
Add the value to the counter atomically and return the new countio.reactivex.Single<Boolean>
rxCompareAndSet(long expected, long value)
Set the counter to the specified value only if the current value is the expectec value.io.reactivex.Single<Long>
rxDecrementAndGet()
Decrement the counter atomically and return the new countio.reactivex.Single<Long>
rxGet()
Get the current value of the counterio.reactivex.Single<Long>
rxGetAndAdd(long value)
Add the value to the counter atomically and return the value before the addio.reactivex.Single<Long>
rxGetAndIncrement()
Increment the counter atomically and return the value before the increment.io.reactivex.Single<Long>
rxIncrementAndGet()
Increment the counter atomically and return the new countString
toString()
-
-
-
Method Detail
-
getDelegate
public Counter getDelegate()
-
get
public void get(Handler<AsyncResult<Long>> resultHandler)
Get the current value of the counter- Parameters:
resultHandler
- handler which will be passed the value
-
get
public void get()
Get the current value of the counter
-
rxGet
public io.reactivex.Single<Long> rxGet()
Get the current value of the counter- Returns:
-
incrementAndGet
public void incrementAndGet(Handler<AsyncResult<Long>> resultHandler)
Increment the counter atomically and return the new count- Parameters:
resultHandler
- handler which will be passed the value
-
incrementAndGet
public void incrementAndGet()
Increment the counter atomically and return the new count
-
rxIncrementAndGet
public io.reactivex.Single<Long> rxIncrementAndGet()
Increment the counter atomically and return the new count- Returns:
-
getAndIncrement
public void getAndIncrement(Handler<AsyncResult<Long>> resultHandler)
Increment the counter atomically and return the value before the increment.- Parameters:
resultHandler
- handler which will be passed the value
-
getAndIncrement
public void getAndIncrement()
Increment the counter atomically and return the value before the increment.
-
rxGetAndIncrement
public io.reactivex.Single<Long> rxGetAndIncrement()
Increment the counter atomically and return the value before the increment.- Returns:
-
decrementAndGet
public void decrementAndGet(Handler<AsyncResult<Long>> resultHandler)
Decrement the counter atomically and return the new count- Parameters:
resultHandler
- handler which will be passed the value
-
decrementAndGet
public void decrementAndGet()
Decrement the counter atomically and return the new count
-
rxDecrementAndGet
public io.reactivex.Single<Long> rxDecrementAndGet()
Decrement the counter atomically and return the new count- Returns:
-
addAndGet
public void addAndGet(long value, Handler<AsyncResult<Long>> resultHandler)
Add the value to the counter atomically and return the new count- Parameters:
value
- the value to addresultHandler
- handler which will be passed the value
-
addAndGet
public void addAndGet(long value)
Add the value to the counter atomically and return the new count- Parameters:
value
- the value to add
-
rxAddAndGet
public io.reactivex.Single<Long> rxAddAndGet(long value)
Add the value to the counter atomically and return the new count- Parameters:
value
- the value to add- Returns:
-
getAndAdd
public void getAndAdd(long value, Handler<AsyncResult<Long>> resultHandler)
Add the value to the counter atomically and return the value before the add- Parameters:
value
- the value to addresultHandler
- handler which will be passed the value
-
getAndAdd
public void getAndAdd(long value)
Add the value to the counter atomically and return the value before the add- Parameters:
value
- the value to add
-
rxGetAndAdd
public io.reactivex.Single<Long> rxGetAndAdd(long value)
Add the value to the counter atomically and return the value before the add- Parameters:
value
- the value to add- Returns:
-
compareAndSet
public void compareAndSet(long expected, long value, Handler<AsyncResult<Boolean>> resultHandler)
Set the counter to the specified value only if the current value is the expectec value. This happens atomically.- Parameters:
expected
- the expected valuevalue
- the new valueresultHandler
- the handler will be passed true on success
-
compareAndSet
public void compareAndSet(long expected, long value)
Set the counter to the specified value only if the current value is the expectec value. This happens atomically.- Parameters:
expected
- the expected valuevalue
- the new value
-
rxCompareAndSet
public io.reactivex.Single<Boolean> rxCompareAndSet(long expected, long value)
Set the counter to the specified value only if the current value is the expectec value. This happens atomically.- Parameters:
expected
- the expected valuevalue
- the new value- Returns:
-
-