public class AsyncResult<T> extends Object implements Future<T>, CompletionStage<T>
It implements both Future and CompletionStage and is therefore similar to CompletableFuture, but read-only, i.e. it cannot be completed.
CompletableFuture| Constructor and Description |
|---|
AsyncResult(CompletionStage<T> completionStage) |
public AsyncResult(CompletionStage<T> completionStage)
public <U> AsyncResult<U> thenApply(Function<? super T,? extends U> fn)
thenApply in interface CompletionStage<T>public <U> AsyncResult<U> thenApplyAsync(Function<? super T,? extends U> fn)
thenApplyAsync in interface CompletionStage<T>public <U> AsyncResult<U> thenApplyAsync(Function<? super T,? extends U> fn, Executor executor)
thenApplyAsync in interface CompletionStage<T>public AsyncResult<Void> thenAccept(Consumer<? super T> action)
thenAccept in interface CompletionStage<T>public AsyncResult<Void> thenAcceptAsync(Consumer<? super T> action)
thenAcceptAsync in interface CompletionStage<T>public AsyncResult<Void> thenAcceptAsync(Consumer<? super T> action, Executor executor)
thenAcceptAsync in interface CompletionStage<T>public AsyncResult<Void> thenRun(Runnable action)
thenRun in interface CompletionStage<T>public AsyncResult<Void> thenRunAsync(Runnable action)
thenRunAsync in interface CompletionStage<T>public AsyncResult<Void> thenRunAsync(Runnable action, Executor executor)
thenRunAsync in interface CompletionStage<T>public <U,V> AsyncResult<V> thenCombine(CompletionStage<? extends U> other, BiFunction<? super T,? super U,? extends V> fn)
thenCombine in interface CompletionStage<T>public <U,V> AsyncResult<V> thenCombineAsync(CompletionStage<? extends U> other, BiFunction<? super T,? super U,? extends V> fn)
thenCombineAsync in interface CompletionStage<T>public <U,V> AsyncResult<V> thenCombineAsync(CompletionStage<? extends U> other, BiFunction<? super T,? super U,? extends V> fn, Executor executor)
thenCombineAsync in interface CompletionStage<T>public <U> AsyncResult<Void> thenAcceptBoth(CompletionStage<? extends U> other, BiConsumer<? super T,? super U> action)
thenAcceptBoth in interface CompletionStage<T>public <U> AsyncResult<Void> thenAcceptBothAsync(CompletionStage<? extends U> other, BiConsumer<? super T,? super U> action)
thenAcceptBothAsync in interface CompletionStage<T>public <U> AsyncResult<Void> thenAcceptBothAsync(CompletionStage<? extends U> other, BiConsumer<? super T,? super U> action, Executor executor)
thenAcceptBothAsync in interface CompletionStage<T>public AsyncResult<Void> runAfterBoth(CompletionStage<?> other, Runnable action)
runAfterBoth in interface CompletionStage<T>public AsyncResult<Void> runAfterBothAsync(CompletionStage<?> other, Runnable action)
runAfterBothAsync in interface CompletionStage<T>public AsyncResult<Void> runAfterBothAsync(CompletionStage<?> other, Runnable action, Executor executor)
runAfterBothAsync in interface CompletionStage<T>public <U> AsyncResult<U> applyToEither(CompletionStage<? extends T> other, Function<? super T,U> fn)
applyToEither in interface CompletionStage<T>public <U> AsyncResult<U> applyToEitherAsync(CompletionStage<? extends T> other, Function<? super T,U> fn)
applyToEitherAsync in interface CompletionStage<T>public <U> AsyncResult<U> applyToEitherAsync(CompletionStage<? extends T> other, Function<? super T,U> fn, Executor executor)
applyToEitherAsync in interface CompletionStage<T>public AsyncResult<Void> acceptEither(CompletionStage<? extends T> other, Consumer<? super T> action)
acceptEither in interface CompletionStage<T>public AsyncResult<Void> acceptEitherAsync(CompletionStage<? extends T> other, Consumer<? super T> action)
acceptEitherAsync in interface CompletionStage<T>public AsyncResult<Void> acceptEitherAsync(CompletionStage<? extends T> other, Consumer<? super T> action, Executor executor)
acceptEitherAsync in interface CompletionStage<T>public AsyncResult<Void> runAfterEither(CompletionStage<?> other, Runnable action)
runAfterEither in interface CompletionStage<T>public AsyncResult<Void> runAfterEitherAsync(CompletionStage<?> other, Runnable action)
runAfterEitherAsync in interface CompletionStage<T>public AsyncResult<Void> runAfterEitherAsync(CompletionStage<?> other, Runnable action, Executor executor)
runAfterEitherAsync in interface CompletionStage<T>public <U> AsyncResult<U> thenCompose(Function<? super T,? extends CompletionStage<U>> fn)
thenCompose in interface CompletionStage<T>public <U> AsyncResult<U> thenComposeAsync(Function<? super T,? extends CompletionStage<U>> fn)
thenComposeAsync in interface CompletionStage<T>public <U> AsyncResult<U> thenComposeAsync(Function<? super T,? extends CompletionStage<U>> fn, Executor executor)
thenComposeAsync in interface CompletionStage<T>public AsyncResult<T> exceptionally(Function<Throwable,? extends T> fn)
exceptionally in interface CompletionStage<T>public AsyncResult<T> whenComplete(BiConsumer<? super T,? super Throwable> action)
whenComplete in interface CompletionStage<T>public AsyncResult<T> whenCompleteAsync(BiConsumer<? super T,? super Throwable> action)
whenCompleteAsync in interface CompletionStage<T>public AsyncResult<T> whenCompleteAsync(BiConsumer<? super T,? super Throwable> action, Executor executor)
whenCompleteAsync in interface CompletionStage<T>public <U> AsyncResult<U> handle(BiFunction<? super T,Throwable,? extends U> fn)
handle in interface CompletionStage<T>public <U> AsyncResult<U> handleAsync(BiFunction<? super T,Throwable,? extends U> fn)
handleAsync in interface CompletionStage<T>public <U> AsyncResult<U> handleAsync(BiFunction<? super T,Throwable,? extends U> fn, Executor executor)
handleAsync in interface CompletionStage<T>public final CompletableFuture<T> toCompletableFuture()
toCompletableFuture in interface CompletionStage<T>public boolean cancel(boolean mayInterruptIfRunning)
Future, i.e. completes it with a CancellationException.public boolean cancel()
Future, i.e. completes it with a CancellationException.
This method is a shortcut to cancel(boolean), because the boolean parameter has no effect in this implementation.
Future is now cancelled.public boolean isCancelled()
isCancelled in interface Future<T>public T get() throws InterruptedException, ExecutionException
get in interface Future<T>InterruptedExceptionExecutionExceptionpublic T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
get in interface Future<T>InterruptedExceptionExecutionExceptionTimeoutExceptionpublic final T getResult() throws XmppException
If the thread, waiting on the result is interrupted, this method continues to block until the result is available.
XmppException - If the response threw an exception.public final T getResult(long timeout, TimeUnit unit) throws XmppException, TimeoutException
If the thread, waiting on the result is interrupted, this method continues to block until the result is available or the timeout elapses.
XmppException - If the response threw an exception.TimeoutException - If the result didn't receive in time.Copyright © 2014–2016 XMPP.rocks. All rights reserved.