Package org.redisson.misc
Class CompletableFutureWrapper<V>
java.lang.Object
org.redisson.misc.CompletableFutureWrapper<V>
- Type Parameters:
V- value type
- All Implemented Interfaces:
CompletionStage<V>,Future<V>,RFuture<V>
- Direct Known Subclasses:
RedissonExecutorBatchFuture,RedissonExecutorFuture
- Author:
- Nikita Koksharov
-
Constructor Summary
ConstructorsConstructorDescriptionCompletableFutureWrapper(CompletableFuture<V> future) CompletableFutureWrapper(CompletionStage<V> stage) CompletableFutureWrapper(List<CompletableFuture<?>> futures) CompletableFutureWrapper(V value) -
Method Summary
Modifier and TypeMethodDescriptionacceptEither(CompletionStage<? extends V> other, Consumer<? super V> action) acceptEitherAsync(CompletionStage<? extends V> other, Consumer<? super V> action) acceptEitherAsync(CompletionStage<? extends V> other, Consumer<? super V> action, Executor executor) <U> CompletionStage<U> applyToEither(CompletionStage<? extends V> other, Function<? super V, U> fn) <U> CompletionStage<U> applyToEitherAsync(CompletionStage<? extends V> other, Function<? super V, U> fn) <U> CompletionStage<U> applyToEitherAsync(CompletionStage<? extends V> other, Function<? super V, U> fn, Executor executor) await()Use snippet below instead.booleanawait(long timeoutMillis) Use snippet below instead.booleanUse snippet below instead.Use snippet below instead.booleanawaitUninterruptibly(long timeoutMillis) Use snippet below instead.booleanawaitUninterruptibly(long timeout, TimeUnit unit) Use snippet below instead.booleancancel(boolean mayInterruptIfRunning) cause()Use snippet below instead.booleanexceptionally(Function<Throwable, ? extends V> fn) get()getNow()Use snippet below instead.<U> CompletionStage<U> handle(BiFunction<? super V, Throwable, ? extends U> fn) <U> CompletionStage<U> handleAsync(BiFunction<? super V, Throwable, ? extends U> fn) <U> CompletionStage<U> handleAsync(BiFunction<? super V, Throwable, ? extends U> fn, Executor executor) booleanbooleanisDone()booleanUse snippet below instead.join()Use toCompletableFuture().join() method insteadvoidonComplete(BiConsumer<? super V, ? super Throwable> action) Use whenComplete() method insteadrunAfterBoth(CompletionStage<?> other, Runnable action) runAfterBothAsync(CompletionStage<?> other, Runnable action) runAfterBothAsync(CompletionStage<?> other, Runnable action, Executor executor) runAfterEither(CompletionStage<?> other, Runnable action) runAfterEitherAsync(CompletionStage<?> other, Runnable action) runAfterEitherAsync(CompletionStage<?> other, Runnable action, Executor executor) sync()Use toCompletableFuture().get() method insteadUse toCompletableFuture().join() method insteadthenAccept(Consumer<? super V> action) thenAcceptAsync(Consumer<? super V> action) thenAcceptAsync(Consumer<? super V> action, Executor executor) <U> CompletionStage<Void> thenAcceptBoth(CompletionStage<? extends U> other, BiConsumer<? super V, ? super U> action) <U> CompletionStage<Void> thenAcceptBothAsync(CompletionStage<? extends U> other, BiConsumer<? super V, ? super U> action) <U> CompletionStage<Void> thenAcceptBothAsync(CompletionStage<? extends U> other, BiConsumer<? super V, ? super U> action, Executor executor) <U> CompletionStage<U> <U> CompletionStage<U> thenApplyAsync(Function<? super V, ? extends U> fn) <U> CompletionStage<U> thenApplyAsync(Function<? super V, ? extends U> fn, Executor executor) <U,V1> CompletionStage <V1> thenCombine(CompletionStage<? extends U> other, BiFunction<? super V, ? super U, ? extends V1> fn) <U,V1> CompletionStage <V1> thenCombineAsync(CompletionStage<? extends U> other, BiFunction<? super V, ? super U, ? extends V1> fn) <U,V1> CompletionStage <V1> thenCombineAsync(CompletionStage<? extends U> other, BiFunction<? super V, ? super U, ? extends V1> fn, Executor executor) <U> CompletionStage<U> thenCompose(Function<? super V, ? extends CompletionStage<U>> fn) <U> CompletionStage<U> thenComposeAsync(Function<? super V, ? extends CompletionStage<U>> fn) <U> CompletionStage<U> thenComposeAsync(Function<? super V, ? extends CompletionStage<U>> fn, Executor executor) thenRunAsync(Runnable action) thenRunAsync(Runnable action, Executor executor) whenComplete(BiConsumer<? super V, ? super Throwable> action) whenCompleteAsync(BiConsumer<? super V, ? super Throwable> action) whenCompleteAsync(BiConsumer<? super V, ? super Throwable> action, Executor executor)
-
Constructor Details
-
CompletableFutureWrapper
-
CompletableFutureWrapper
-
CompletableFutureWrapper
-
CompletableFutureWrapper
-
CompletableFutureWrapper
-
-
Method Details
-
thenApply
- Specified by:
thenApplyin interfaceCompletionStage<V>
-
thenApplyAsync
- Specified by:
thenApplyAsyncin interfaceCompletionStage<V>
-
thenApplyAsync
- Specified by:
thenApplyAsyncin interfaceCompletionStage<V>
-
thenAccept
- Specified by:
thenAcceptin interfaceCompletionStage<V>
-
thenAcceptAsync
- Specified by:
thenAcceptAsyncin interfaceCompletionStage<V>
-
thenAcceptAsync
- Specified by:
thenAcceptAsyncin interfaceCompletionStage<V>
-
thenRun
- Specified by:
thenRunin interfaceCompletionStage<V>
-
thenRunAsync
- Specified by:
thenRunAsyncin interfaceCompletionStage<V>
-
thenRunAsync
- Specified by:
thenRunAsyncin interfaceCompletionStage<V>
-
thenCombine
public <U,V1> CompletionStage<V1> thenCombine(CompletionStage<? extends U> other, BiFunction<? super V, ? super U, ? extends V1> fn) - Specified by:
thenCombinein interfaceCompletionStage<V>
-
thenCombineAsync
public <U,V1> CompletionStage<V1> thenCombineAsync(CompletionStage<? extends U> other, BiFunction<? super V, ? super U, ? extends V1> fn) - Specified by:
thenCombineAsyncin interfaceCompletionStage<V>
-
thenCombineAsync
public <U,V1> CompletionStage<V1> thenCombineAsync(CompletionStage<? extends U> other, BiFunction<? super V, ? super U, ? extends V1> fn, Executor executor) - Specified by:
thenCombineAsyncin interfaceCompletionStage<V>
-
thenAcceptBoth
public <U> CompletionStage<Void> thenAcceptBoth(CompletionStage<? extends U> other, BiConsumer<? super V, ? super U> action) - Specified by:
thenAcceptBothin interfaceCompletionStage<V>
-
thenAcceptBothAsync
public <U> CompletionStage<Void> thenAcceptBothAsync(CompletionStage<? extends U> other, BiConsumer<? super V, ? super U> action) - Specified by:
thenAcceptBothAsyncin interfaceCompletionStage<V>
-
thenAcceptBothAsync
public <U> CompletionStage<Void> thenAcceptBothAsync(CompletionStage<? extends U> other, BiConsumer<? super V, ? super U> action, Executor executor) - Specified by:
thenAcceptBothAsyncin interfaceCompletionStage<V>
-
runAfterBoth
- Specified by:
runAfterBothin interfaceCompletionStage<V>
-
runAfterBothAsync
- Specified by:
runAfterBothAsyncin interfaceCompletionStage<V>
-
runAfterBothAsync
public CompletionStage<Void> runAfterBothAsync(CompletionStage<?> other, Runnable action, Executor executor) - Specified by:
runAfterBothAsyncin interfaceCompletionStage<V>
-
applyToEither
public <U> CompletionStage<U> applyToEither(CompletionStage<? extends V> other, Function<? super V, U> fn) - Specified by:
applyToEitherin interfaceCompletionStage<V>
-
applyToEitherAsync
public <U> CompletionStage<U> applyToEitherAsync(CompletionStage<? extends V> other, Function<? super V, U> fn) - Specified by:
applyToEitherAsyncin interfaceCompletionStage<V>
-
applyToEitherAsync
public <U> CompletionStage<U> applyToEitherAsync(CompletionStage<? extends V> other, Function<? super V, U> fn, Executor executor) - Specified by:
applyToEitherAsyncin interfaceCompletionStage<V>
-
acceptEither
public CompletionStage<Void> acceptEither(CompletionStage<? extends V> other, Consumer<? super V> action) - Specified by:
acceptEitherin interfaceCompletionStage<V>
-
acceptEitherAsync
public CompletionStage<Void> acceptEitherAsync(CompletionStage<? extends V> other, Consumer<? super V> action) - Specified by:
acceptEitherAsyncin interfaceCompletionStage<V>
-
acceptEitherAsync
public CompletionStage<Void> acceptEitherAsync(CompletionStage<? extends V> other, Consumer<? super V> action, Executor executor) - Specified by:
acceptEitherAsyncin interfaceCompletionStage<V>
-
runAfterEither
- Specified by:
runAfterEitherin interfaceCompletionStage<V>
-
runAfterEitherAsync
- Specified by:
runAfterEitherAsyncin interfaceCompletionStage<V>
-
runAfterEitherAsync
public CompletionStage<Void> runAfterEitherAsync(CompletionStage<?> other, Runnable action, Executor executor) - Specified by:
runAfterEitherAsyncin interfaceCompletionStage<V>
-
thenCompose
- Specified by:
thenComposein interfaceCompletionStage<V>
-
thenComposeAsync
- Specified by:
thenComposeAsyncin interfaceCompletionStage<V>
-
thenComposeAsync
public <U> CompletionStage<U> thenComposeAsync(Function<? super V, ? extends CompletionStage<U>> fn, Executor executor) - Specified by:
thenComposeAsyncin interfaceCompletionStage<V>
-
handle
- Specified by:
handlein interfaceCompletionStage<V>
-
handleAsync
- Specified by:
handleAsyncin interfaceCompletionStage<V>
-
handleAsync
public <U> CompletionStage<U> handleAsync(BiFunction<? super V, Throwable, ? extends U> fn, Executor executor) - Specified by:
handleAsyncin interfaceCompletionStage<V>
-
whenComplete
- Specified by:
whenCompletein interfaceCompletionStage<V>
-
whenCompleteAsync
- Specified by:
whenCompleteAsyncin interfaceCompletionStage<V>
-
whenCompleteAsync
public CompletionStage<V> whenCompleteAsync(BiConsumer<? super V, ? super Throwable> action, Executor executor) - Specified by:
whenCompleteAsyncin interfaceCompletionStage<V>
-
exceptionally
- Specified by:
exceptionallyin interfaceCompletionStage<V>
-
toCompletableFuture
- Specified by:
toCompletableFuturein interfaceCompletionStage<V>
-
getNow
-
complete
-
cancel
public boolean cancel(boolean mayInterruptIfRunning) -
isCancelled
public boolean isCancelled()- Specified by:
isCancelledin interfaceFuture<V>
-
isDone
public boolean isDone() -
get
- Specified by:
getin interfaceFuture<V>- Throws:
InterruptedExceptionExecutionException
-
get
public V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException - Specified by:
getin interfaceFuture<V>- Throws:
InterruptedExceptionExecutionExceptionTimeoutException
-
isSuccess
public boolean isSuccess()Description copied from interface:RFutureUse snippet below instead.return toCompletableFuture().isDone() invalid input: '&'invalid input: '&' !toCompletableFuture().isCompletedExceptionally(); -
cause
Description copied from interface:RFutureUse snippet below instead.if (toCompletableFuture().isDone()) { try { toCompletableFuture().getNow(null); } catch (CompletionException e) { return e.getCause(); } catch (CancellationException e) { return e; } } return null; -
getNow
Description copied from interface:RFutureUse snippet below instead.try { return toCompletableFuture().getNow(null); } catch (Exception e) { return null; } -
join
Description copied from interface:RFutureUse toCompletableFuture().join() method instead -
await
Description copied from interface:RFutureUse snippet below instead.try { toCompletableFuture().get(); } catch (Exception e) { // skip }- Specified by:
awaitin interfaceRFuture<V>- Parameters:
timeout- - wait timeoutunit- - time unit- Returns:
trueif and only if the future was completed within the specified time limit- Throws:
InterruptedException- if the current thread was interrupted
-
await
Description copied from interface:RFutureUse snippet below instead.try { toCompletableFuture().get(); } catch (Exception e) { // skip }- Specified by:
awaitin interfaceRFuture<V>- Parameters:
timeoutMillis- - timeout value- Returns:
trueif and only if the future was completed within the specified time limit- Throws:
InterruptedException- if the current thread was interrupted
-
sync
Description copied from interface:RFutureUse toCompletableFuture().get() method instead- Specified by:
syncin interfaceRFuture<V>- Returns:
- Future object
- Throws:
InterruptedException- if the current thread was interrupted
-
syncUninterruptibly
Description copied from interface:RFutureUse toCompletableFuture().join() method instead- Specified by:
syncUninterruptiblyin interfaceRFuture<V>- Returns:
- Future object
-
await
Description copied from interface:RFutureUse snippet below instead.try { toCompletableFuture().get(); } catch (Exception e) { // skip }- Specified by:
awaitin interfaceRFuture<V>- Returns:
- Future object
- Throws:
InterruptedException- if the current thread was interrupted
-
awaitUninterruptibly
Description copied from interface:RFutureUse snippet below instead.try { rFuture.toCompletableFuture().join(); } catch (Exception e) { // skip }- Specified by:
awaitUninterruptiblyin interfaceRFuture<V>- Returns:
- Future object
-
awaitUninterruptibly
Description copied from interface:RFutureUse snippet below instead.try { toCompletableFuture().get(); } catch (Exception e) { // skip }- Specified by:
awaitUninterruptiblyin interfaceRFuture<V>- Parameters:
timeout- - timeout valueunit- - timeout unit value- Returns:
trueif and only if the future was completed within the specified time limit
-
awaitUninterruptibly
public boolean awaitUninterruptibly(long timeoutMillis) Description copied from interface:RFutureUse snippet below instead.try { toCompletableFuture().get(); } catch (Exception e) { // skip }- Specified by:
awaitUninterruptiblyin interfaceRFuture<V>- Parameters:
timeoutMillis- - timeout value- Returns:
trueif and only if the future was completed within the specified time limit
-
onComplete
Description copied from interface:RFutureUse whenComplete() method instead- Specified by:
onCompletein interfaceRFuture<V>- Parameters:
action- - callback
-