Package io.lettuce.core
Interface ConnectionFuture<T>
-
- All Superinterfaces:
CompletionStage<T>
,Future<T>
public interface ConnectionFuture<T> extends CompletionStage<T>, Future<T>
AConnectionFuture
represents the result of an asynchronous connection initialization. The future provides aStatefulConnection
on successful completion. It also provides the remoteSocketAddress
.- Since:
- 4.4
-
-
Method Summary
-
Methods inherited from interface java.util.concurrent.CompletionStage
toCompletableFuture
-
Methods inherited from interface java.util.concurrent.Future
cancel, get, isCancelled, isDone
-
-
-
-
Method Detail
-
from
static <T> ConnectionFuture<T> from(SocketAddress remoteAddress, CompletableFuture<T> delegate)
Create aConnectionFuture
givenSocketAddress
andCompletableFuture
holding the connection progress.- Parameters:
remoteAddress
- initial connection endpoint, must not benull
.delegate
- must not benull
.- Returns:
- the
ConnectionFuture
forSocketAddress
andCompletableFuture
. - Since:
- 5.0
-
completed
static <T> ConnectionFuture<T> completed(SocketAddress remoteAddress, T value)
- Parameters:
remoteAddress
- initial connection endpoint, must not benull
.value
- must not benull
.- Returns:
- the
ConnectionFuture
forSocketAddress
andvalue
. - Since:
- 5.1
-
get
T get() throws InterruptedException, ExecutionException
Waits if necessary for the computation to complete, and then retrieves its result.- Specified by:
get
in 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 benull
until 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)CompletionException
with 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
<U> ConnectionFuture<U> thenApply(Function<? super T,? extends U> fn)
- Specified by:
thenApply
in interfaceCompletionStage<T>
-
thenApplyAsync
<U> ConnectionFuture<U> thenApplyAsync(Function<? super T,? extends U> fn)
- Specified by:
thenApplyAsync
in interfaceCompletionStage<T>
-
thenApplyAsync
<U> ConnectionFuture<U> thenApplyAsync(Function<? super T,? extends U> fn, Executor executor)
- Specified by:
thenApplyAsync
in interfaceCompletionStage<T>
-
thenAccept
ConnectionFuture<Void> thenAccept(Consumer<? super T> action)
- Specified by:
thenAccept
in interfaceCompletionStage<T>
-
thenAcceptAsync
ConnectionFuture<Void> thenAcceptAsync(Consumer<? super T> action)
- Specified by:
thenAcceptAsync
in interfaceCompletionStage<T>
-
thenAcceptAsync
ConnectionFuture<Void> thenAcceptAsync(Consumer<? super T> action, Executor executor)
- Specified by:
thenAcceptAsync
in interfaceCompletionStage<T>
-
thenRun
ConnectionFuture<Void> thenRun(Runnable action)
- Specified by:
thenRun
in interfaceCompletionStage<T>
-
thenRunAsync
ConnectionFuture<Void> thenRunAsync(Runnable action)
- Specified by:
thenRunAsync
in interfaceCompletionStage<T>
-
thenRunAsync
ConnectionFuture<Void> thenRunAsync(Runnable action, Executor executor)
- Specified by:
thenRunAsync
in interfaceCompletionStage<T>
-
thenCombine
<U,V> ConnectionFuture<V> thenCombine(CompletionStage<? extends U> other, BiFunction<? super T,? super U,? extends V> fn)
- Specified by:
thenCombine
in interfaceCompletionStage<T>
-
thenCombineAsync
<U,V> ConnectionFuture<V> thenCombineAsync(CompletionStage<? extends U> other, BiFunction<? super T,? super U,? extends V> fn)
- Specified by:
thenCombineAsync
in interfaceCompletionStage<T>
-
thenCombineAsync
<U,V> ConnectionFuture<V> thenCombineAsync(CompletionStage<? extends U> other, BiFunction<? super T,? super U,? extends V> fn, Executor executor)
- Specified by:
thenCombineAsync
in interfaceCompletionStage<T>
-
thenAcceptBoth
<U> ConnectionFuture<Void> thenAcceptBoth(CompletionStage<? extends U> other, BiConsumer<? super T,? super U> action)
- Specified by:
thenAcceptBoth
in interfaceCompletionStage<T>
-
thenAcceptBothAsync
<U> ConnectionFuture<Void> thenAcceptBothAsync(CompletionStage<? extends U> other, BiConsumer<? super T,? super U> action)
- Specified by:
thenAcceptBothAsync
in interfaceCompletionStage<T>
-
thenAcceptBothAsync
<U> ConnectionFuture<Void> thenAcceptBothAsync(CompletionStage<? extends U> other, BiConsumer<? super T,? super U> action, Executor executor)
- Specified by:
thenAcceptBothAsync
in interfaceCompletionStage<T>
-
runAfterBoth
ConnectionFuture<Void> runAfterBoth(CompletionStage<?> other, Runnable action)
- Specified by:
runAfterBoth
in interfaceCompletionStage<T>
-
runAfterBothAsync
ConnectionFuture<Void> runAfterBothAsync(CompletionStage<?> other, Runnable action)
- Specified by:
runAfterBothAsync
in interfaceCompletionStage<T>
-
runAfterBothAsync
ConnectionFuture<Void> runAfterBothAsync(CompletionStage<?> other, Runnable action, Executor executor)
- Specified by:
runAfterBothAsync
in interfaceCompletionStage<T>
-
applyToEither
<U> ConnectionFuture<U> applyToEither(CompletionStage<? extends T> other, Function<? super T,U> fn)
- Specified by:
applyToEither
in interfaceCompletionStage<T>
-
applyToEitherAsync
<U> ConnectionFuture<U> applyToEitherAsync(CompletionStage<? extends T> other, Function<? super T,U> fn)
- Specified by:
applyToEitherAsync
in interfaceCompletionStage<T>
-
applyToEitherAsync
<U> ConnectionFuture<U> applyToEitherAsync(CompletionStage<? extends T> other, Function<? super T,U> fn, Executor executor)
- Specified by:
applyToEitherAsync
in interfaceCompletionStage<T>
-
acceptEither
ConnectionFuture<Void> acceptEither(CompletionStage<? extends T> other, Consumer<? super T> action)
- Specified by:
acceptEither
in interfaceCompletionStage<T>
-
acceptEitherAsync
ConnectionFuture<Void> acceptEitherAsync(CompletionStage<? extends T> other, Consumer<? super T> action)
- Specified by:
acceptEitherAsync
in interfaceCompletionStage<T>
-
acceptEitherAsync
ConnectionFuture<Void> acceptEitherAsync(CompletionStage<? extends T> other, Consumer<? super T> action, Executor executor)
- Specified by:
acceptEitherAsync
in interfaceCompletionStage<T>
-
runAfterEither
ConnectionFuture<Void> runAfterEither(CompletionStage<?> other, Runnable action)
- Specified by:
runAfterEither
in interfaceCompletionStage<T>
-
runAfterEitherAsync
ConnectionFuture<Void> runAfterEitherAsync(CompletionStage<?> other, Runnable action)
- Specified by:
runAfterEitherAsync
in interfaceCompletionStage<T>
-
runAfterEitherAsync
ConnectionFuture<Void> runAfterEitherAsync(CompletionStage<?> other, Runnable action, Executor executor)
- Specified by:
runAfterEitherAsync
in interfaceCompletionStage<T>
-
thenCompose
<U> ConnectionFuture<U> thenCompose(Function<? super T,? extends CompletionStage<U>> fn)
- Specified by:
thenCompose
in interfaceCompletionStage<T>
-
thenCompose
<U> ConnectionFuture<U> thenCompose(BiFunction<? super T,? super Throwable,? extends CompletionStage<U>> fn)
-
thenComposeAsync
<U> ConnectionFuture<U> thenComposeAsync(Function<? super T,? extends CompletionStage<U>> fn)
- Specified by:
thenComposeAsync
in interfaceCompletionStage<T>
-
thenComposeAsync
<U> ConnectionFuture<U> thenComposeAsync(Function<? super T,? extends CompletionStage<U>> fn, Executor executor)
- Specified by:
thenComposeAsync
in interfaceCompletionStage<T>
-
exceptionally
ConnectionFuture<T> exceptionally(Function<Throwable,? extends T> fn)
- Specified by:
exceptionally
in interfaceCompletionStage<T>
-
whenComplete
ConnectionFuture<T> whenComplete(BiConsumer<? super T,? super Throwable> action)
- Specified by:
whenComplete
in interfaceCompletionStage<T>
-
whenCompleteAsync
ConnectionFuture<T> whenCompleteAsync(BiConsumer<? super T,? super Throwable> action)
- Specified by:
whenCompleteAsync
in interfaceCompletionStage<T>
-
whenCompleteAsync
ConnectionFuture<T> whenCompleteAsync(BiConsumer<? super T,? super Throwable> action, Executor executor)
- Specified by:
whenCompleteAsync
in interfaceCompletionStage<T>
-
handle
<U> ConnectionFuture<U> handle(BiFunction<? super T,Throwable,? extends U> fn)
- Specified by:
handle
in interfaceCompletionStage<T>
-
handleAsync
<U> ConnectionFuture<U> handleAsync(BiFunction<? super T,Throwable,? extends U> fn)
- Specified by:
handleAsync
in interfaceCompletionStage<T>
-
handleAsync
<U> ConnectionFuture<U> handleAsync(BiFunction<? super T,Throwable,? extends U> fn, Executor executor)
- Specified by:
handleAsync
in interfaceCompletionStage<T>
-
-