- All Superinterfaces:
CompletionStage<T>,Future<T>
public interface ConnectionFuture<T> extends CompletionStage<T>, Future<T>
A
ConnectionFuture represents the result of an asynchronous connection initialization. The future provides a
StatefulConnection on successful completion. It also provides the remote SocketAddress.- Since:
- 4.4
-
Method Summary
Methods inherited from interface java.util.concurrent.CompletionStage
exceptionallyAsync, exceptionallyAsync, exceptionallyCompose, exceptionallyComposeAsync, exceptionallyComposeAsync, toCompletableFutureMethods inherited from interface java.util.concurrent.Future
cancel, get, isCancelled, isDone
-
Method Details
-
from
Create aConnectionFuturegivenSocketAddressandCompletableFutureholding the connection progress.- Parameters:
remoteAddress- initial connection endpoint, must not benull.delegate- must not benull.- Returns:
- the
ConnectionFutureforSocketAddressandCompletableFuture. - Since:
- 5.0
-
completed
- Parameters:
remoteAddress- initial connection endpoint, must not benull.value- must not benull.- Returns:
- the
ConnectionFutureforSocketAddressandvalue. - Since:
- 5.1
-
get
Waits if necessary for the computation to complete, and then retrieves its result.- Specified by:
getin interfaceFuture<T>- Returns:
- the computed result
- Throws:
CancellationException- if the computation was cancelledExecutionException- if the computation threw an exceptionInterruptedException- if the current thread was interrupted while waiting
-
getRemoteAddress
SocketAddress getRemoteAddress()Return the remoteSocketAddress.- Returns:
- the remote
SocketAddress. May benulluntil the socket address is resolved.
-
join
T join()Returns the result value when complete, or throws an (unchecked) exception if completed exceptionally. To better conform with the use of common functional forms, if a computation involved in the completion of this CompletableFuture threw an exception, this method throws an (unchecked)CompletionExceptionwith the underlying exception as its cause.- Returns:
- the result value
- Throws:
CancellationException- if the computation was cancelledCompletionException- if this future completed exceptionally or a completion computation threw an exception
-
thenApply
- Specified by:
thenApplyin interfaceCompletionStage<T>
-
thenApplyAsync
- Specified by:
thenApplyAsyncin interfaceCompletionStage<T>
-
thenApplyAsync
- Specified by:
thenApplyAsyncin interfaceCompletionStage<T>
-
thenAccept
- Specified by:
thenAcceptin interfaceCompletionStage<T>
-
thenAcceptAsync
- Specified by:
thenAcceptAsyncin interfaceCompletionStage<T>
-
thenAcceptAsync
- Specified by:
thenAcceptAsyncin interfaceCompletionStage<T>
-
thenRun
- Specified by:
thenRunin interfaceCompletionStage<T>
-
thenRunAsync
- Specified by:
thenRunAsyncin interfaceCompletionStage<T>
-
thenRunAsync
- Specified by:
thenRunAsyncin interfaceCompletionStage<T>
-
thenCombine
<U, V> ConnectionFuture<V> thenCombine(CompletionStage<? extends U> other, BiFunction<? super T,? super U,? extends V> fn)- Specified by:
thenCombinein interfaceCompletionStage<T>
-
thenCombineAsync
<U, V> ConnectionFuture<V> thenCombineAsync(CompletionStage<? extends U> other, BiFunction<? super T,? super U,? extends V> fn)- Specified by:
thenCombineAsyncin interfaceCompletionStage<T>
-
thenCombineAsync
<U, V> ConnectionFuture<V> thenCombineAsync(CompletionStage<? extends U> other, BiFunction<? super T,? super U,? extends V> fn, Executor executor)- Specified by:
thenCombineAsyncin interfaceCompletionStage<T>
-
thenAcceptBoth
<U> ConnectionFuture<Void> thenAcceptBoth(CompletionStage<? extends U> other, BiConsumer<? super T,? super U> action)- Specified by:
thenAcceptBothin interfaceCompletionStage<T>
-
thenAcceptBothAsync
<U> ConnectionFuture<Void> thenAcceptBothAsync(CompletionStage<? extends U> other, BiConsumer<? super T,? super U> action)- Specified by:
thenAcceptBothAsyncin interfaceCompletionStage<T>
-
thenAcceptBothAsync
<U> ConnectionFuture<Void> thenAcceptBothAsync(CompletionStage<? extends U> other, BiConsumer<? super T,? super U> action, Executor executor)- Specified by:
thenAcceptBothAsyncin interfaceCompletionStage<T>
-
runAfterBoth
- Specified by:
runAfterBothin interfaceCompletionStage<T>
-
runAfterBothAsync
- Specified by:
runAfterBothAsyncin interfaceCompletionStage<T>
-
runAfterBothAsync
ConnectionFuture<Void> runAfterBothAsync(CompletionStage<?> other, Runnable action, Executor executor)- Specified by:
runAfterBothAsyncin interfaceCompletionStage<T>
-
applyToEither
<U> ConnectionFuture<U> applyToEither(CompletionStage<? extends T> other, Function<? super T,U> fn)- Specified by:
applyToEitherin interfaceCompletionStage<T>
-
applyToEitherAsync
<U> ConnectionFuture<U> applyToEitherAsync(CompletionStage<? extends T> other, Function<? super T,U> fn)- Specified by:
applyToEitherAsyncin interfaceCompletionStage<T>
-
applyToEitherAsync
<U> ConnectionFuture<U> applyToEitherAsync(CompletionStage<? extends T> other, Function<? super T,U> fn, Executor executor)- Specified by:
applyToEitherAsyncin interfaceCompletionStage<T>
-
acceptEither
ConnectionFuture<Void> acceptEither(CompletionStage<? extends T> other, Consumer<? super T> action)- Specified by:
acceptEitherin interfaceCompletionStage<T>
-
acceptEitherAsync
ConnectionFuture<Void> acceptEitherAsync(CompletionStage<? extends T> other, Consumer<? super T> action)- Specified by:
acceptEitherAsyncin interfaceCompletionStage<T>
-
acceptEitherAsync
ConnectionFuture<Void> acceptEitherAsync(CompletionStage<? extends T> other, Consumer<? super T> action, Executor executor)- Specified by:
acceptEitherAsyncin interfaceCompletionStage<T>
-
runAfterEither
- Specified by:
runAfterEitherin interfaceCompletionStage<T>
-
runAfterEitherAsync
- Specified by:
runAfterEitherAsyncin interfaceCompletionStage<T>
-
runAfterEitherAsync
ConnectionFuture<Void> runAfterEitherAsync(CompletionStage<?> other, Runnable action, Executor executor)- Specified by:
runAfterEitherAsyncin interfaceCompletionStage<T>
-
thenCompose
- Specified by:
thenComposein interfaceCompletionStage<T>
-
thenCompose
<U> ConnectionFuture<U> thenCompose(BiFunction<? super T,? super Throwable,? extends CompletionStage<U>> fn) -
thenComposeAsync
- Specified by:
thenComposeAsyncin interfaceCompletionStage<T>
-
thenComposeAsync
<U> ConnectionFuture<U> thenComposeAsync(Function<? super T,? extends CompletionStage<U>> fn, Executor executor)- Specified by:
thenComposeAsyncin interfaceCompletionStage<T>
-
exceptionally
- Specified by:
exceptionallyin interfaceCompletionStage<T>
-
whenComplete
- Specified by:
whenCompletein interfaceCompletionStage<T>
-
whenCompleteAsync
- Specified by:
whenCompleteAsyncin interfaceCompletionStage<T>
-
whenCompleteAsync
ConnectionFuture<T> whenCompleteAsync(BiConsumer<? super T,? super Throwable> action, Executor executor)- Specified by:
whenCompleteAsyncin interfaceCompletionStage<T>
-
handle
- Specified by:
handlein interfaceCompletionStage<T>
-
handleAsync
- Specified by:
handleAsyncin interfaceCompletionStage<T>
-
handleAsync
<U> ConnectionFuture<U> handleAsync(BiFunction<? super T,Throwable,? extends U> fn, Executor executor)- Specified by:
handleAsyncin interfaceCompletionStage<T>
-