/** * 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; }
/** * 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); })); }
/** * 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); })); }