public static Counter newInstance(io.vertx.core.shareddata.Counter arg) { return arg != null ? new Counter(arg) : null; } }
/** * Add the value to the counter atomically and return the value before the add * @param value the value to add * @return * @deprecated use {@link #rxGetAndAdd} instead */ @Deprecated() public Observable<Long> getAndAddObservable(long value) { io.vertx.rx.java.ObservableFuture<Long> resultHandler = io.vertx.rx.java.RxHelper.observableFuture(); getAndAdd(value, resultHandler.toHandler()); return resultHandler; }
/** * Get the current value of the counter * @return * @deprecated use {@link #rxGet} instead */ @Deprecated() public Observable<Long> getObservable() { io.vertx.rx.java.ObservableFuture<Long> resultHandler = io.vertx.rx.java.RxHelper.observableFuture(); get(resultHandler.toHandler()); return resultHandler; }
/** * Increment the counter atomically and return the value before the increment. * @return * @deprecated use {@link #rxGetAndIncrement} instead */ @Deprecated() public Observable<Long> getAndIncrementObservable() { io.vertx.rx.java.ObservableFuture<Long> resultHandler = io.vertx.rx.java.RxHelper.observableFuture(); getAndIncrement(resultHandler.toHandler()); return resultHandler; }
/** * Decrement the counter atomically and return the new count * @return * @deprecated use {@link #rxDecrementAndGet} instead */ @Deprecated() public Observable<Long> decrementAndGetObservable() { io.vertx.rx.java.ObservableFuture<Long> resultHandler = io.vertx.rx.java.RxHelper.observableFuture(); decrementAndGet(resultHandler.toHandler()); return resultHandler; }
/** * Increment the counter atomically and return the new count * @return * @deprecated use {@link #rxIncrementAndGet} instead */ @Deprecated() public Observable<Long> incrementAndGetObservable() { io.vertx.rx.java.ObservableFuture<Long> resultHandler = io.vertx.rx.java.RxHelper.observableFuture(); incrementAndGet(resultHandler.toHandler()); return resultHandler; }
/** * Set the counter to the specified value only if the current value is the expectec value. This happens * atomically. * @param expected the expected value * @param value the new value * @return * @deprecated use {@link #rxCompareAndSet} instead */ @Deprecated() public Observable<Boolean> compareAndSetObservable(long expected, long value) { io.vertx.rx.java.ObservableFuture<Boolean> resultHandler = io.vertx.rx.java.RxHelper.observableFuture(); compareAndSet(expected, value, resultHandler.toHandler()); return resultHandler; }
/** * Add the value to the counter atomically and return the new count * @param value the value to add * @return * @deprecated use {@link #rxAddAndGet} instead */ @Deprecated() public Observable<Long> addAndGetObservable(long value) { io.vertx.rx.java.ObservableFuture<Long> resultHandler = io.vertx.rx.java.RxHelper.observableFuture(); addAndGet(value, resultHandler.toHandler()); return resultHandler; }
.flatMap(counter -> counter.rxCompareAndSet(0, 1)) .flatMapCompletable(success -> { if (success) {
/** * Add the value to the counter atomically and return the value before the add * @param value the value to add * @return */ public Single<Long> rxGetAndAdd(long value) { return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> { getAndAdd(value, fut); })); }
/** * Get the current value of the counter * @return */ public Single<Long> rxGet() { return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> { get(fut); })); }
/** * Increment the counter atomically and return the value before the increment. * @return */ public Single<Long> rxGetAndIncrement() { return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> { getAndIncrement(fut); })); }
/** * Decrement the counter atomically and return the new count * @return */ public Single<Long> rxDecrementAndGet() { return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> { decrementAndGet(fut); })); }
/** * Increment the counter atomically and return the new count * @return */ public Single<Long> rxIncrementAndGet() { return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> { incrementAndGet(fut); })); }
/** * Set the counter to the specified value only if the current value is the expectec value. This happens * atomically. * @param expected the expected value * @param value the new value * @return */ public Single<Boolean> rxCompareAndSet(long expected, long value) { return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> { compareAndSet(expected, value, fut); })); }
/** * Add the value to the counter atomically and return the new count * @param value the value to add * @return */ public Single<Long> rxAddAndGet(long value) { return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> { addAndGet(value, fut); })); }
/** * Add the value to the counter atomically and return the value before the add * @param value the value to add * @return */ public Single<Long> rxGetAndAdd(long value) { return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> { getAndAdd(value, fut); })); }
/** * Get the current value of the counter * @return */ public Single<Long> rxGet() { return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> { get(fut); })); }
/** * Increment the counter atomically and return the value before the increment. * @return */ public Single<Long> rxGetAndIncrement() { return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> { getAndIncrement(fut); })); }
/** * Decrement the counter atomically and return the new count * @return */ public Single<Long> rxDecrementAndGet() { return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> { decrementAndGet(fut); })); }