public class PromiseDelegator<T> extends Object implements RPromise<T>
| Constructor and Description |
|---|
PromiseDelegator(RPromise<T> promise) |
| Modifier and Type | Method and Description |
|---|---|
CompletionStage<Void> |
acceptEither(CompletionStage<? extends T> other,
Consumer<? super T> action) |
CompletionStage<Void> |
acceptEitherAsync(CompletionStage<? extends T> other,
Consumer<? super T> action) |
CompletionStage<Void> |
acceptEitherAsync(CompletionStage<? extends T> other,
Consumer<? super T> action,
Executor executor) |
RPromise<T> |
addListener(io.netty.util.concurrent.FutureListener<? super T> listener)
Use methods from
CompletionStage interface |
RPromise<T> |
addListeners(io.netty.util.concurrent.FutureListener<? super T>... listeners)
Use methods from
CompletionStage interface |
<U> CompletionStage<U> |
applyToEither(CompletionStage<? extends T> other,
Function<? super T,U> fn) |
<U> CompletionStage<U> |
applyToEitherAsync(CompletionStage<? extends T> other,
Function<? super T,U> fn) |
<U> CompletionStage<U> |
applyToEitherAsync(CompletionStage<? extends T> other,
Function<? super T,U> fn,
Executor executor) |
RPromise<T> |
await()
Waits for this future to be completed.
|
boolean |
await(long timeoutMillis)
Waits for this future to be completed within the
specified time limit.
|
boolean |
await(long timeout,
TimeUnit unit)
Waits for this future to be completed within the
specified time limit.
|
RPromise<T> |
awaitUninterruptibly()
Waits for this future to be completed without
interruption.
|
boolean |
awaitUninterruptibly(long timeoutMillis)
Waits for this future to be completed within the
specified time limit without interruption.
|
boolean |
awaitUninterruptibly(long timeout,
TimeUnit unit)
Waits for this future to be completed within the
specified time limit without interruption.
|
boolean |
cancel(boolean mayInterruptIfRunning) |
Throwable |
cause()
Returns the cause of the failed I/O operation if the I/O operation has
failed.
|
CompletionStage<T> |
exceptionally(Function<Throwable,? extends T> fn) |
T |
get() |
T |
get(long timeout,
TimeUnit unit) |
RPromise<T> |
getInnerPromise() |
T |
getNow()
Return the result without blocking.
|
<U> CompletionStage<U> |
handle(BiFunction<? super T,Throwable,? extends U> fn) |
<U> CompletionStage<U> |
handleAsync(BiFunction<? super T,Throwable,? extends U> fn) |
<U> CompletionStage<U> |
handleAsync(BiFunction<? super T,Throwable,? extends U> fn,
Executor executor) |
boolean |
hasListeners() |
boolean |
isCancelled() |
boolean |
isDone() |
boolean |
isSuccess()
Returns
true if and only if the I/O operation was completed
successfully. |
T |
join()
Returns the result value when complete, or throws an
(unchecked) exception if completed exceptionally.
|
RPromise<T> |
removeListener(io.netty.util.concurrent.FutureListener<? super T> listener) |
RPromise<T> |
removeListeners(io.netty.util.concurrent.FutureListener<? super T>... listeners) |
CompletionStage<Void> |
runAfterBoth(CompletionStage<?> other,
Runnable action) |
CompletionStage<Void> |
runAfterBothAsync(CompletionStage<?> other,
Runnable action) |
CompletionStage<Void> |
runAfterBothAsync(CompletionStage<?> other,
Runnable action,
Executor executor) |
CompletionStage<Void> |
runAfterEither(CompletionStage<?> other,
Runnable action) |
CompletionStage<Void> |
runAfterEitherAsync(CompletionStage<?> other,
Runnable action) |
CompletionStage<Void> |
runAfterEitherAsync(CompletionStage<?> other,
Runnable action,
Executor executor) |
boolean |
setUncancellable()
Make this future impossible to cancel.
|
RPromise<T> |
sync()
Waits for this future until it is done, and rethrows the cause of the failure if this future
failed.
|
RPromise<T> |
syncUninterruptibly()
Waits for this future until it is done, and rethrows the cause of the failure if this future
failed.
|
CompletionStage<Void> |
thenAccept(Consumer<? super T> action) |
CompletionStage<Void> |
thenAcceptAsync(Consumer<? super T> action) |
CompletionStage<Void> |
thenAcceptAsync(Consumer<? super T> action,
Executor executor) |
<U> CompletionStage<Void> |
thenAcceptBoth(CompletionStage<? extends U> other,
BiConsumer<? super T,? super U> action) |
<U> CompletionStage<Void> |
thenAcceptBothAsync(CompletionStage<? extends U> other,
BiConsumer<? super T,? super U> action) |
<U> CompletionStage<Void> |
thenAcceptBothAsync(CompletionStage<? extends U> other,
BiConsumer<? super T,? super U> action,
Executor executor) |
<U> CompletionStage<U> |
thenApply(Function<? super T,? extends U> fn) |
<U> CompletionStage<U> |
thenApplyAsync(Function<? super T,? extends U> fn) |
<U> CompletionStage<U> |
thenApplyAsync(Function<? super T,? extends U> fn,
Executor executor) |
<U,V> CompletionStage<V> |
thenCombine(CompletionStage<? extends U> other,
BiFunction<? super T,? super U,? extends V> fn) |
<U,V> CompletionStage<V> |
thenCombineAsync(CompletionStage<? extends U> other,
BiFunction<? super T,? super U,? extends V> fn) |
<U,V> CompletionStage<V> |
thenCombineAsync(CompletionStage<? extends U> other,
BiFunction<? super T,? super U,? extends V> fn,
Executor executor) |
<U> CompletionStage<U> |
thenCompose(Function<? super T,? extends CompletionStage<U>> fn) |
<U> CompletionStage<U> |
thenComposeAsync(Function<? super T,? extends CompletionStage<U>> fn) |
<U> CompletionStage<U> |
thenComposeAsync(Function<? super T,? extends CompletionStage<U>> fn,
Executor executor) |
CompletionStage<Void> |
thenRun(Runnable action) |
CompletionStage<Void> |
thenRunAsync(Runnable action) |
CompletionStage<Void> |
thenRunAsync(Runnable action,
Executor executor) |
CompletableFuture<T> |
toCompletableFuture() |
boolean |
tryFailure(Throwable cause)
Marks this future as a failure and notifies all
listeners.
|
boolean |
trySuccess(T result)
Marks this future as a success and notifies all
listeners.
|
CompletionStage<T> |
whenComplete(BiConsumer<? super T,? super Throwable> action) |
CompletionStage<T> |
whenCompleteAsync(BiConsumer<? super T,? super Throwable> action) |
CompletionStage<T> |
whenCompleteAsync(BiConsumer<? super T,? super Throwable> action,
Executor executor) |
public T join()
RFuturepublic boolean isSuccess()
RFuturetrue if and only if the I/O operation was completed
successfully.public boolean trySuccess(T result)
RPromisetrySuccess in interface RPromise<T>result - objecttrue if and only if successfully marked this future as
a success. Otherwise false because this future is
already marked as either a success or a failure.public Throwable cause()
RFuturepublic T getNow()
RFuturenull.
As it is possible that a null value is used to mark the future as successful you also need to check
if the future is really done with Future.isDone() and not relay on the returned null value.public boolean tryFailure(Throwable cause)
RPromisetryFailure in interface RPromise<T>cause - objecttrue if and only if successfully marked this future as
a failure. Otherwise false because this future is
already marked as either a success or a failure.public boolean await(long timeout,
TimeUnit unit)
throws InterruptedException
RFutureawait in interface RFuture<T>timeout - - wait timeoutunit - - time unittrue if and only if the future was completed within
the specified time limitInterruptedException - if the current thread was interruptedpublic boolean setUncancellable()
RPromisesetUncancellable in interface RPromise<T>true if and only if successfully marked this future as uncancellable or it is already done
without being cancelled. false if this future has been cancelled already.public boolean await(long timeoutMillis)
throws InterruptedException
RFutureawait in interface RFuture<T>timeoutMillis - - timeout valuetrue if and only if the future was completed within
the specified time limitInterruptedException - if the current thread was interruptedpublic RPromise<T> addListener(io.netty.util.concurrent.FutureListener<? super T> listener)
RFutureCompletionStage interfaceaddListener in interface RFuture<T>addListener in interface RPromise<T>listener - - listener for future objectpublic RPromise<T> addListeners(io.netty.util.concurrent.FutureListener<? super T>... listeners)
RFutureCompletionStage interfaceaddListeners in interface RFuture<T>addListeners in interface RPromise<T>listeners - - listeners for future objectpublic RPromise<T> removeListener(io.netty.util.concurrent.FutureListener<? super T> listener)
removeListener in interface RFuture<T>removeListener in interface RPromise<T>public RPromise<T> removeListeners(io.netty.util.concurrent.FutureListener<? super T>... listeners)
removeListeners in interface RFuture<T>removeListeners in interface RPromise<T>public RPromise<T> await() throws InterruptedException
RFuturepublic boolean cancel(boolean mayInterruptIfRunning)
public RPromise<T> awaitUninterruptibly()
RFutureInterruptedException and
discards it silently.awaitUninterruptibly in interface RFuture<T>awaitUninterruptibly in interface RPromise<T>public RPromise<T> sync() throws InterruptedException
RFuturepublic RPromise<T> syncUninterruptibly()
RFuturesyncUninterruptibly in interface RFuture<T>syncUninterruptibly in interface RPromise<T>public boolean isCancelled()
isCancelled in interface Future<T>public T get() throws InterruptedException, ExecutionException
get in interface Future<T>InterruptedExceptionExecutionExceptionpublic boolean awaitUninterruptibly(long timeout,
TimeUnit unit)
RFutureInterruptedException and discards it silently.awaitUninterruptibly in interface RFuture<T>timeout - - timeout valueunit - - timeout unit valuetrue if and only if the future was completed within
the specified time limitpublic T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
get in interface Future<T>InterruptedExceptionExecutionExceptionTimeoutExceptionpublic <U> CompletionStage<U> thenApply(Function<? super T,? extends U> fn)
thenApply in interface CompletionStage<T>public boolean awaitUninterruptibly(long timeoutMillis)
RFutureInterruptedException and discards it silently.awaitUninterruptibly in interface RFuture<T>timeoutMillis - - timeout valuetrue if and only if the future was completed within
the specified time limitpublic <U> CompletionStage<U> thenApplyAsync(Function<? super T,? extends U> fn)
thenApplyAsync in interface CompletionStage<T>public <U> CompletionStage<U> thenApplyAsync(Function<? super T,? extends U> fn, Executor executor)
thenApplyAsync in interface CompletionStage<T>public CompletionStage<Void> thenAccept(Consumer<? super T> action)
thenAccept in interface CompletionStage<T>public CompletionStage<Void> thenAcceptAsync(Consumer<? super T> action)
thenAcceptAsync in interface CompletionStage<T>public boolean hasListeners()
hasListeners in interface RPromise<T>public CompletionStage<Void> thenAcceptAsync(Consumer<? super T> action, Executor executor)
thenAcceptAsync in interface CompletionStage<T>public CompletionStage<Void> thenRun(Runnable action)
thenRun in interface CompletionStage<T>public CompletionStage<Void> thenRunAsync(Runnable action)
thenRunAsync in interface CompletionStage<T>public CompletionStage<Void> thenRunAsync(Runnable action, Executor executor)
thenRunAsync in interface CompletionStage<T>public <U,V> CompletionStage<V> thenCombine(CompletionStage<? extends U> other, BiFunction<? super T,? super U,? extends V> fn)
thenCombine in interface CompletionStage<T>public <U,V> CompletionStage<V> thenCombineAsync(CompletionStage<? extends U> other, BiFunction<? super T,? super U,? extends V> fn)
thenCombineAsync in interface CompletionStage<T>public <U,V> CompletionStage<V> thenCombineAsync(CompletionStage<? extends U> other, BiFunction<? super T,? super U,? extends V> fn, Executor executor)
thenCombineAsync in interface CompletionStage<T>public <U> CompletionStage<Void> thenAcceptBoth(CompletionStage<? extends U> other, BiConsumer<? super T,? super U> action)
thenAcceptBoth in interface CompletionStage<T>public <U> CompletionStage<Void> thenAcceptBothAsync(CompletionStage<? extends U> other, BiConsumer<? super T,? super U> action)
thenAcceptBothAsync in interface CompletionStage<T>public <U> CompletionStage<Void> thenAcceptBothAsync(CompletionStage<? extends U> other, BiConsumer<? super T,? super U> action, Executor executor)
thenAcceptBothAsync in interface CompletionStage<T>public CompletionStage<Void> runAfterBoth(CompletionStage<?> other, Runnable action)
runAfterBoth in interface CompletionStage<T>public CompletionStage<Void> runAfterBothAsync(CompletionStage<?> other, Runnable action)
runAfterBothAsync in interface CompletionStage<T>public CompletionStage<Void> runAfterBothAsync(CompletionStage<?> other, Runnable action, Executor executor)
runAfterBothAsync in interface CompletionStage<T>public <U> CompletionStage<U> applyToEither(CompletionStage<? extends T> other, Function<? super T,U> fn)
applyToEither in interface CompletionStage<T>public <U> CompletionStage<U> applyToEitherAsync(CompletionStage<? extends T> other, Function<? super T,U> fn)
applyToEitherAsync in interface CompletionStage<T>public <U> CompletionStage<U> applyToEitherAsync(CompletionStage<? extends T> other, Function<? super T,U> fn, Executor executor)
applyToEitherAsync in interface CompletionStage<T>public CompletionStage<Void> acceptEither(CompletionStage<? extends T> other, Consumer<? super T> action)
acceptEither in interface CompletionStage<T>public CompletionStage<Void> acceptEitherAsync(CompletionStage<? extends T> other, Consumer<? super T> action)
acceptEitherAsync in interface CompletionStage<T>public CompletionStage<Void> acceptEitherAsync(CompletionStage<? extends T> other, Consumer<? super T> action, Executor executor)
acceptEitherAsync in interface CompletionStage<T>public CompletionStage<Void> runAfterEither(CompletionStage<?> other, Runnable action)
runAfterEither in interface CompletionStage<T>public CompletionStage<Void> runAfterEitherAsync(CompletionStage<?> other, Runnable action)
runAfterEitherAsync in interface CompletionStage<T>public CompletionStage<Void> runAfterEitherAsync(CompletionStage<?> other, Runnable action, Executor executor)
runAfterEitherAsync in interface CompletionStage<T>public <U> CompletionStage<U> thenCompose(Function<? super T,? extends CompletionStage<U>> fn)
thenCompose in interface CompletionStage<T>public <U> CompletionStage<U> thenComposeAsync(Function<? super T,? extends CompletionStage<U>> fn)
thenComposeAsync in interface CompletionStage<T>public <U> CompletionStage<U> thenComposeAsync(Function<? super T,? extends CompletionStage<U>> fn, Executor executor)
thenComposeAsync in interface CompletionStage<T>public CompletionStage<T> exceptionally(Function<Throwable,? extends T> fn)
exceptionally in interface CompletionStage<T>public CompletionStage<T> whenComplete(BiConsumer<? super T,? super Throwable> action)
whenComplete in interface CompletionStage<T>public CompletionStage<T> whenCompleteAsync(BiConsumer<? super T,? super Throwable> action)
whenCompleteAsync in interface CompletionStage<T>public CompletionStage<T> whenCompleteAsync(BiConsumer<? super T,? super Throwable> action, Executor executor)
whenCompleteAsync in interface CompletionStage<T>public <U> CompletionStage<U> handle(BiFunction<? super T,Throwable,? extends U> fn)
handle in interface CompletionStage<T>public <U> CompletionStage<U> handleAsync(BiFunction<? super T,Throwable,? extends U> fn)
handleAsync in interface CompletionStage<T>public <U> CompletionStage<U> handleAsync(BiFunction<? super T,Throwable,? extends U> fn, Executor executor)
handleAsync in interface CompletionStage<T>public CompletableFuture<T> toCompletableFuture()
toCompletableFuture in interface CompletionStage<T>Copyright © 2014–2018 The Redisson Project. All rights reserved.