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 voidaddAndGet(long value)Add the value to the counter atomically and return the new countvoidaddAndGet(long value, Handler<AsyncResult<Long>> resultHandler)Add the value to the counter atomically and return the new countvoidcompareAndSet(long expected, long value)Set the counter to the specified value only if the current value is the expectec value.voidcompareAndSet(long expected, long value, Handler<AsyncResult<Boolean>> resultHandler)Set the counter to the specified value only if the current value is the expectec value.voiddecrementAndGet()Decrement the counter atomically and return the new countvoiddecrementAndGet(Handler<AsyncResult<Long>> resultHandler)Decrement the counter atomically and return the new countbooleanequals(Object o)voidget()Get the current value of the countervoidget(Handler<AsyncResult<Long>> resultHandler)Get the current value of the countervoidgetAndAdd(long value)Add the value to the counter atomically and return the value before the addvoidgetAndAdd(long value, Handler<AsyncResult<Long>> resultHandler)Add the value to the counter atomically and return the value before the addvoidgetAndIncrement()Increment the counter atomically and return the value before the increment.voidgetAndIncrement(Handler<AsyncResult<Long>> resultHandler)Increment the counter atomically and return the value before the increment.CountergetDelegate()inthashCode()voidincrementAndGet()Increment the counter atomically and return the new countvoidincrementAndGet(Handler<AsyncResult<Long>> resultHandler)Increment the counter atomically and return the new countstatic CounternewInstance(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 countStringtoString()
-
-
-
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:
-
-