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
,RedissonScheduledFuture
- Author:
- Nikita Koksharov
-
Constructor Summary
ConstructorDescriptionCompletableFutureWrapper
(CompletableFuture<V> future) CompletableFutureWrapper
(CompletionStage<V> stage) 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.boolean
await
(long timeoutMillis) Use snippet below instead.boolean
Use snippet below instead.Use snippet below instead.boolean
awaitUninterruptibly
(long timeoutMillis) Use snippet below instead.boolean
awaitUninterruptibly
(long timeout, TimeUnit unit) Use snippet below instead.boolean
cancel
(boolean mayInterruptIfRunning) cause()
Use snippet below instead.boolean
exceptionally
(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) boolean
boolean
isDone()
boolean
Use snippet below instead.join()
Use toCompletableFuture().join() method insteadvoid
onComplete
(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) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.concurrent.CompletionStage
exceptionallyAsync, exceptionallyAsync, exceptionallyCompose, exceptionallyComposeAsync, exceptionallyComposeAsync
-
Constructor Details
-
CompletableFutureWrapper
-
CompletableFutureWrapper
-
CompletableFutureWrapper
-
CompletableFutureWrapper
-
-
Method Details
-
thenApply
- Specified by:
thenApply
in interfaceCompletionStage<V>
-
thenApplyAsync
- Specified by:
thenApplyAsync
in interfaceCompletionStage<V>
-
thenApplyAsync
- Specified by:
thenApplyAsync
in interfaceCompletionStage<V>
-
thenAccept
- Specified by:
thenAccept
in interfaceCompletionStage<V>
-
thenAcceptAsync
- Specified by:
thenAcceptAsync
in interfaceCompletionStage<V>
-
thenAcceptAsync
- Specified by:
thenAcceptAsync
in interfaceCompletionStage<V>
-
thenRun
- Specified by:
thenRun
in interfaceCompletionStage<V>
-
thenRunAsync
- Specified by:
thenRunAsync
in interfaceCompletionStage<V>
-
thenRunAsync
- Specified by:
thenRunAsync
in interfaceCompletionStage<V>
-
thenCombine
public <U,V1> CompletionStage<V1> thenCombine(CompletionStage<? extends U> other, BiFunction<? super V, ? super U, ? extends V1> fn) - Specified by:
thenCombine
in interfaceCompletionStage<V>
-
thenCombineAsync
public <U,V1> CompletionStage<V1> thenCombineAsync(CompletionStage<? extends U> other, BiFunction<? super V, ? super U, ? extends V1> fn) - Specified by:
thenCombineAsync
in 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:
thenCombineAsync
in interfaceCompletionStage<V>
-
thenAcceptBoth
public <U> CompletionStage<Void> thenAcceptBoth(CompletionStage<? extends U> other, BiConsumer<? super V, ? super U> action) - Specified by:
thenAcceptBoth
in interfaceCompletionStage<V>
-
thenAcceptBothAsync
public <U> CompletionStage<Void> thenAcceptBothAsync(CompletionStage<? extends U> other, BiConsumer<? super V, ? super U> action) - Specified by:
thenAcceptBothAsync
in interfaceCompletionStage<V>
-
thenAcceptBothAsync
public <U> CompletionStage<Void> thenAcceptBothAsync(CompletionStage<? extends U> other, BiConsumer<? super V, ? super U> action, Executor executor) - Specified by:
thenAcceptBothAsync
in interfaceCompletionStage<V>
-
runAfterBoth
- Specified by:
runAfterBoth
in interfaceCompletionStage<V>
-
runAfterBothAsync
- Specified by:
runAfterBothAsync
in interfaceCompletionStage<V>
-
runAfterBothAsync
public CompletionStage<Void> runAfterBothAsync(CompletionStage<?> other, Runnable action, Executor executor) - Specified by:
runAfterBothAsync
in interfaceCompletionStage<V>
-
applyToEither
public <U> CompletionStage<U> applyToEither(CompletionStage<? extends V> other, Function<? super V, U> fn) - Specified by:
applyToEither
in interfaceCompletionStage<V>
-
applyToEitherAsync
public <U> CompletionStage<U> applyToEitherAsync(CompletionStage<? extends V> other, Function<? super V, U> fn) - Specified by:
applyToEitherAsync
in interfaceCompletionStage<V>
-
applyToEitherAsync
public <U> CompletionStage<U> applyToEitherAsync(CompletionStage<? extends V> other, Function<? super V, U> fn, Executor executor) - Specified by:
applyToEitherAsync
in interfaceCompletionStage<V>
-
acceptEither
public CompletionStage<Void> acceptEither(CompletionStage<? extends V> other, Consumer<? super V> action) - Specified by:
acceptEither
in interfaceCompletionStage<V>
-
acceptEitherAsync
public CompletionStage<Void> acceptEitherAsync(CompletionStage<? extends V> other, Consumer<? super V> action) - Specified by:
acceptEitherAsync
in interfaceCompletionStage<V>
-
acceptEitherAsync
public CompletionStage<Void> acceptEitherAsync(CompletionStage<? extends V> other, Consumer<? super V> action, Executor executor) - Specified by:
acceptEitherAsync
in interfaceCompletionStage<V>
-
runAfterEither
- Specified by:
runAfterEither
in interfaceCompletionStage<V>
-
runAfterEitherAsync
- Specified by:
runAfterEitherAsync
in interfaceCompletionStage<V>
-
runAfterEitherAsync
public CompletionStage<Void> runAfterEitherAsync(CompletionStage<?> other, Runnable action, Executor executor) - Specified by:
runAfterEitherAsync
in interfaceCompletionStage<V>
-
thenCompose
- Specified by:
thenCompose
in interfaceCompletionStage<V>
-
thenComposeAsync
- Specified by:
thenComposeAsync
in interfaceCompletionStage<V>
-
thenComposeAsync
public <U> CompletionStage<U> thenComposeAsync(Function<? super V, ? extends CompletionStage<U>> fn, Executor executor) - Specified by:
thenComposeAsync
in interfaceCompletionStage<V>
-
handle
- Specified by:
handle
in interfaceCompletionStage<V>
-
handleAsync
- Specified by:
handleAsync
in interfaceCompletionStage<V>
-
handleAsync
public <U> CompletionStage<U> handleAsync(BiFunction<? super V, Throwable, ? extends U> fn, Executor executor) - Specified by:
handleAsync
in interfaceCompletionStage<V>
-
whenComplete
- Specified by:
whenComplete
in interfaceCompletionStage<V>
-
whenCompleteAsync
- Specified by:
whenCompleteAsync
in interfaceCompletionStage<V>
-
whenCompleteAsync
public CompletionStage<V> whenCompleteAsync(BiConsumer<? super V, ? super Throwable> action, Executor executor) - Specified by:
whenCompleteAsync
in interfaceCompletionStage<V>
-
exceptionally
- Specified by:
exceptionally
in interfaceCompletionStage<V>
-
toCompletableFuture
- Specified by:
toCompletableFuture
in interfaceCompletionStage<V>
-
getNow
-
complete
-
cancel
public boolean cancel(boolean mayInterruptIfRunning) -
isCancelled
public boolean isCancelled()- Specified by:
isCancelled
in interfaceFuture<V>
-
isDone
public boolean isDone() -
get
- Specified by:
get
in interfaceFuture<V>
- Throws:
InterruptedException
ExecutionException
-
get
public V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException - Specified by:
get
in interfaceFuture<V>
- Throws:
InterruptedException
ExecutionException
TimeoutException
-
isSuccess
public boolean isSuccess()Description copied from interface:RFuture
Use snippet below instead.return toCompletableFuture().isDone() && !toCompletableFuture().isCompletedExceptionally();
-
cause
Description copied from interface:RFuture
Use 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:RFuture
Use snippet below instead.try { return toCompletableFuture().getNow(null); } catch (Exception e) { return null; }
-
join
Description copied from interface:RFuture
Use toCompletableFuture().join() method instead -
await
Description copied from interface:RFuture
Use snippet below instead.try { toCompletableFuture().get(); } catch (Exception e) { // skip }
- Specified by:
await
in interfaceRFuture<V>
- Parameters:
timeout
- - wait timeoutunit
- - time unit- Returns:
true
if 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:RFuture
Use snippet below instead.try { toCompletableFuture().get(); } catch (Exception e) { // skip }
- Specified by:
await
in interfaceRFuture<V>
- Parameters:
timeoutMillis
- - timeout value- Returns:
true
if 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:RFuture
Use toCompletableFuture().get() method instead- Specified by:
sync
in interfaceRFuture<V>
- Returns:
- Future object
- Throws:
InterruptedException
- if the current thread was interrupted
-
syncUninterruptibly
Description copied from interface:RFuture
Use toCompletableFuture().join() method instead- Specified by:
syncUninterruptibly
in interfaceRFuture<V>
- Returns:
- Future object
-
await
Description copied from interface:RFuture
Use snippet below instead.try { toCompletableFuture().get(); } catch (Exception e) { // skip }
- Specified by:
await
in interfaceRFuture<V>
- Returns:
- Future object
- Throws:
InterruptedException
- if the current thread was interrupted
-
awaitUninterruptibly
Description copied from interface:RFuture
Use snippet below instead.try { rFuture.toCompletableFuture().join(); } catch (Exception e) { // skip }
- Specified by:
awaitUninterruptibly
in interfaceRFuture<V>
- Returns:
- Future object
-
awaitUninterruptibly
Description copied from interface:RFuture
Use snippet below instead.try { toCompletableFuture().get(); } catch (Exception e) { // skip }
- Specified by:
awaitUninterruptibly
in interfaceRFuture<V>
- Parameters:
timeout
- - timeout valueunit
- - timeout unit value- Returns:
true
if and only if the future was completed within the specified time limit
-
awaitUninterruptibly
public boolean awaitUninterruptibly(long timeoutMillis) Description copied from interface:RFuture
Use snippet below instead.try { toCompletableFuture().get(); } catch (Exception e) { // skip }
- Specified by:
awaitUninterruptibly
in interfaceRFuture<V>
- Parameters:
timeoutMillis
- - timeout value- Returns:
true
if and only if the future was completed within the specified time limit
-
onComplete
Description copied from interface:RFuture
Use whenComplete() method instead- Specified by:
onComplete
in interfaceRFuture<V>
- Parameters:
action
- - callback
-