Package org.onlab.util
Class BlockingAwareFuture<T>
- java.lang.Object
-
- java.util.concurrent.CompletableFuture<T>
-
- org.onlab.util.BlockingAwareFuture<T>
-
- All Implemented Interfaces:
java.util.concurrent.CompletionStage<T>
,java.util.concurrent.Future<T>
public class BlockingAwareFuture<T> extends java.util.concurrent.CompletableFuture<T>
ACompletableFuture
that tracks whether the future or one of its descendants has been blocked on aCompletableFuture.get()
orCompletableFuture.join()
call.
-
-
Constructor Summary
Constructors Constructor Description BlockingAwareFuture()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.concurrent.CompletableFuture<java.lang.Void>
acceptEither(java.util.concurrent.CompletionStage<? extends T> other, java.util.function.Consumer<? super T> action)
java.util.concurrent.CompletableFuture<java.lang.Void>
acceptEitherAsync(java.util.concurrent.CompletionStage<? extends T> other, java.util.function.Consumer<? super T> action)
java.util.concurrent.CompletableFuture<java.lang.Void>
acceptEitherAsync(java.util.concurrent.CompletionStage<? extends T> other, java.util.function.Consumer<? super T> action, java.util.concurrent.Executor executor)
<U> java.util.concurrent.CompletableFuture<U>
applyToEither(java.util.concurrent.CompletionStage<? extends T> other, java.util.function.Function<? super T,U> fn)
<U> java.util.concurrent.CompletableFuture<U>
applyToEitherAsync(java.util.concurrent.CompletionStage<? extends T> other, java.util.function.Function<? super T,U> fn)
<U> java.util.concurrent.CompletableFuture<U>
applyToEitherAsync(java.util.concurrent.CompletionStage<? extends T> other, java.util.function.Function<? super T,U> fn, java.util.concurrent.Executor executor)
T
get()
T
get(long timeout, java.util.concurrent.TimeUnit unit)
<U> java.util.concurrent.CompletableFuture<U>
handle(java.util.function.BiFunction<? super T,java.lang.Throwable,? extends U> fn)
<U> java.util.concurrent.CompletableFuture<U>
handleAsync(java.util.function.BiFunction<? super T,java.lang.Throwable,? extends U> fn)
<U> java.util.concurrent.CompletableFuture<U>
handleAsync(java.util.function.BiFunction<? super T,java.lang.Throwable,? extends U> fn, java.util.concurrent.Executor executor)
boolean
isBlocked()
Returns a boolean indicating whether the future is blocked.T
join()
java.util.concurrent.CompletableFuture<java.lang.Void>
runAfterBoth(java.util.concurrent.CompletionStage<?> other, java.lang.Runnable action)
java.util.concurrent.CompletableFuture<java.lang.Void>
runAfterBothAsync(java.util.concurrent.CompletionStage<?> other, java.lang.Runnable action)
java.util.concurrent.CompletableFuture<java.lang.Void>
runAfterBothAsync(java.util.concurrent.CompletionStage<?> other, java.lang.Runnable action, java.util.concurrent.Executor executor)
java.util.concurrent.CompletableFuture<java.lang.Void>
runAfterEither(java.util.concurrent.CompletionStage<?> other, java.lang.Runnable action)
java.util.concurrent.CompletableFuture<java.lang.Void>
runAfterEitherAsync(java.util.concurrent.CompletionStage<?> other, java.lang.Runnable action)
java.util.concurrent.CompletableFuture<java.lang.Void>
runAfterEitherAsync(java.util.concurrent.CompletionStage<?> other, java.lang.Runnable action, java.util.concurrent.Executor executor)
java.util.concurrent.CompletableFuture<java.lang.Void>
thenAccept(java.util.function.Consumer<? super T> action)
java.util.concurrent.CompletableFuture<java.lang.Void>
thenAcceptAsync(java.util.function.Consumer<? super T> action)
java.util.concurrent.CompletableFuture<java.lang.Void>
thenAcceptAsync(java.util.function.Consumer<? super T> action, java.util.concurrent.Executor executor)
<U> java.util.concurrent.CompletableFuture<java.lang.Void>
thenAcceptBoth(java.util.concurrent.CompletionStage<? extends U> other, java.util.function.BiConsumer<? super T,? super U> action)
<U> java.util.concurrent.CompletableFuture<java.lang.Void>
thenAcceptBothAsync(java.util.concurrent.CompletionStage<? extends U> other, java.util.function.BiConsumer<? super T,? super U> action)
<U> java.util.concurrent.CompletableFuture<java.lang.Void>
thenAcceptBothAsync(java.util.concurrent.CompletionStage<? extends U> other, java.util.function.BiConsumer<? super T,? super U> action, java.util.concurrent.Executor executor)
<U> java.util.concurrent.CompletableFuture<U>
thenApply(java.util.function.Function<? super T,? extends U> fn)
<U> java.util.concurrent.CompletableFuture<U>
thenApplyAsync(java.util.function.Function<? super T,? extends U> fn)
<U> java.util.concurrent.CompletableFuture<U>
thenApplyAsync(java.util.function.Function<? super T,? extends U> fn, java.util.concurrent.Executor executor)
<U,V>
java.util.concurrent.CompletableFuture<V>thenCombine(java.util.concurrent.CompletionStage<? extends U> other, java.util.function.BiFunction<? super T,? super U,? extends V> fn)
<U,V>
java.util.concurrent.CompletableFuture<V>thenCombineAsync(java.util.concurrent.CompletionStage<? extends U> other, java.util.function.BiFunction<? super T,? super U,? extends V> fn)
<U,V>
java.util.concurrent.CompletableFuture<V>thenCombineAsync(java.util.concurrent.CompletionStage<? extends U> other, java.util.function.BiFunction<? super T,? super U,? extends V> fn, java.util.concurrent.Executor executor)
<U> java.util.concurrent.CompletableFuture<U>
thenCompose(java.util.function.Function<? super T,? extends java.util.concurrent.CompletionStage<U>> fn)
<U> java.util.concurrent.CompletableFuture<U>
thenComposeAsync(java.util.function.Function<? super T,? extends java.util.concurrent.CompletionStage<U>> fn)
<U> java.util.concurrent.CompletableFuture<U>
thenComposeAsync(java.util.function.Function<? super T,? extends java.util.concurrent.CompletionStage<U>> fn, java.util.concurrent.Executor executor)
java.util.concurrent.CompletableFuture<java.lang.Void>
thenRun(java.lang.Runnable action)
java.util.concurrent.CompletableFuture<java.lang.Void>
thenRunAsync(java.lang.Runnable action)
java.util.concurrent.CompletableFuture<java.lang.Void>
thenRunAsync(java.lang.Runnable action, java.util.concurrent.Executor executor)
java.util.concurrent.CompletableFuture<T>
whenComplete(java.util.function.BiConsumer<? super T,? super java.lang.Throwable> action)
java.util.concurrent.CompletableFuture<T>
whenCompleteAsync(java.util.function.BiConsumer<? super T,? super java.lang.Throwable> action)
java.util.concurrent.CompletableFuture<T>
whenCompleteAsync(java.util.function.BiConsumer<? super T,? super java.lang.Throwable> action, java.util.concurrent.Executor executor)
-
Methods inherited from class java.util.concurrent.CompletableFuture
allOf, anyOf, cancel, complete, completeAsync, completeAsync, completedFuture, completedStage, completeExceptionally, completeOnTimeout, copy, defaultExecutor, delayedExecutor, delayedExecutor, exceptionally, failedFuture, failedStage, getNow, getNumberOfDependents, isCancelled, isCompletedExceptionally, isDone, minimalCompletionStage, newIncompleteFuture, obtrudeException, obtrudeValue, orTimeout, runAsync, runAsync, supplyAsync, supplyAsync, toCompletableFuture, toString
-
-
-
-
Method Detail
-
isBlocked
public boolean isBlocked()
Returns a boolean indicating whether the future is blocked.- Returns:
- indicates whether the future is blocked
-
get
public T get() throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
-
get
public T get(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException, java.util.concurrent.TimeoutException
-
thenApply
public <U> java.util.concurrent.CompletableFuture<U> thenApply(java.util.function.Function<? super T,? extends U> fn)
-
thenApplyAsync
public <U> java.util.concurrent.CompletableFuture<U> thenApplyAsync(java.util.function.Function<? super T,? extends U> fn)
-
thenApplyAsync
public <U> java.util.concurrent.CompletableFuture<U> thenApplyAsync(java.util.function.Function<? super T,? extends U> fn, java.util.concurrent.Executor executor)
-
thenAccept
public java.util.concurrent.CompletableFuture<java.lang.Void> thenAccept(java.util.function.Consumer<? super T> action)
-
thenAcceptAsync
public java.util.concurrent.CompletableFuture<java.lang.Void> thenAcceptAsync(java.util.function.Consumer<? super T> action)
-
thenAcceptAsync
public java.util.concurrent.CompletableFuture<java.lang.Void> thenAcceptAsync(java.util.function.Consumer<? super T> action, java.util.concurrent.Executor executor)
-
thenRun
public java.util.concurrent.CompletableFuture<java.lang.Void> thenRun(java.lang.Runnable action)
-
thenRunAsync
public java.util.concurrent.CompletableFuture<java.lang.Void> thenRunAsync(java.lang.Runnable action)
-
thenRunAsync
public java.util.concurrent.CompletableFuture<java.lang.Void> thenRunAsync(java.lang.Runnable action, java.util.concurrent.Executor executor)
-
thenCombine
public <U,V> java.util.concurrent.CompletableFuture<V> thenCombine(java.util.concurrent.CompletionStage<? extends U> other, java.util.function.BiFunction<? super T,? super U,? extends V> fn)
-
thenCombineAsync
public <U,V> java.util.concurrent.CompletableFuture<V> thenCombineAsync(java.util.concurrent.CompletionStage<? extends U> other, java.util.function.BiFunction<? super T,? super U,? extends V> fn)
-
thenCombineAsync
public <U,V> java.util.concurrent.CompletableFuture<V> thenCombineAsync(java.util.concurrent.CompletionStage<? extends U> other, java.util.function.BiFunction<? super T,? super U,? extends V> fn, java.util.concurrent.Executor executor)
-
thenAcceptBoth
public <U> java.util.concurrent.CompletableFuture<java.lang.Void> thenAcceptBoth(java.util.concurrent.CompletionStage<? extends U> other, java.util.function.BiConsumer<? super T,? super U> action)
-
thenAcceptBothAsync
public <U> java.util.concurrent.CompletableFuture<java.lang.Void> thenAcceptBothAsync(java.util.concurrent.CompletionStage<? extends U> other, java.util.function.BiConsumer<? super T,? super U> action)
-
thenAcceptBothAsync
public <U> java.util.concurrent.CompletableFuture<java.lang.Void> thenAcceptBothAsync(java.util.concurrent.CompletionStage<? extends U> other, java.util.function.BiConsumer<? super T,? super U> action, java.util.concurrent.Executor executor)
-
runAfterBoth
public java.util.concurrent.CompletableFuture<java.lang.Void> runAfterBoth(java.util.concurrent.CompletionStage<?> other, java.lang.Runnable action)
-
runAfterBothAsync
public java.util.concurrent.CompletableFuture<java.lang.Void> runAfterBothAsync(java.util.concurrent.CompletionStage<?> other, java.lang.Runnable action)
-
runAfterBothAsync
public java.util.concurrent.CompletableFuture<java.lang.Void> runAfterBothAsync(java.util.concurrent.CompletionStage<?> other, java.lang.Runnable action, java.util.concurrent.Executor executor)
-
applyToEither
public <U> java.util.concurrent.CompletableFuture<U> applyToEither(java.util.concurrent.CompletionStage<? extends T> other, java.util.function.Function<? super T,U> fn)
-
applyToEitherAsync
public <U> java.util.concurrent.CompletableFuture<U> applyToEitherAsync(java.util.concurrent.CompletionStage<? extends T> other, java.util.function.Function<? super T,U> fn)
-
applyToEitherAsync
public <U> java.util.concurrent.CompletableFuture<U> applyToEitherAsync(java.util.concurrent.CompletionStage<? extends T> other, java.util.function.Function<? super T,U> fn, java.util.concurrent.Executor executor)
-
acceptEither
public java.util.concurrent.CompletableFuture<java.lang.Void> acceptEither(java.util.concurrent.CompletionStage<? extends T> other, java.util.function.Consumer<? super T> action)
-
acceptEitherAsync
public java.util.concurrent.CompletableFuture<java.lang.Void> acceptEitherAsync(java.util.concurrent.CompletionStage<? extends T> other, java.util.function.Consumer<? super T> action)
-
acceptEitherAsync
public java.util.concurrent.CompletableFuture<java.lang.Void> acceptEitherAsync(java.util.concurrent.CompletionStage<? extends T> other, java.util.function.Consumer<? super T> action, java.util.concurrent.Executor executor)
-
runAfterEither
public java.util.concurrent.CompletableFuture<java.lang.Void> runAfterEither(java.util.concurrent.CompletionStage<?> other, java.lang.Runnable action)
-
runAfterEitherAsync
public java.util.concurrent.CompletableFuture<java.lang.Void> runAfterEitherAsync(java.util.concurrent.CompletionStage<?> other, java.lang.Runnable action)
-
runAfterEitherAsync
public java.util.concurrent.CompletableFuture<java.lang.Void> runAfterEitherAsync(java.util.concurrent.CompletionStage<?> other, java.lang.Runnable action, java.util.concurrent.Executor executor)
-
thenCompose
public <U> java.util.concurrent.CompletableFuture<U> thenCompose(java.util.function.Function<? super T,? extends java.util.concurrent.CompletionStage<U>> fn)
-
thenComposeAsync
public <U> java.util.concurrent.CompletableFuture<U> thenComposeAsync(java.util.function.Function<? super T,? extends java.util.concurrent.CompletionStage<U>> fn)
-
thenComposeAsync
public <U> java.util.concurrent.CompletableFuture<U> thenComposeAsync(java.util.function.Function<? super T,? extends java.util.concurrent.CompletionStage<U>> fn, java.util.concurrent.Executor executor)
-
whenComplete
public java.util.concurrent.CompletableFuture<T> whenComplete(java.util.function.BiConsumer<? super T,? super java.lang.Throwable> action)
-
whenCompleteAsync
public java.util.concurrent.CompletableFuture<T> whenCompleteAsync(java.util.function.BiConsumer<? super T,? super java.lang.Throwable> action)
-
whenCompleteAsync
public java.util.concurrent.CompletableFuture<T> whenCompleteAsync(java.util.function.BiConsumer<? super T,? super java.lang.Throwable> action, java.util.concurrent.Executor executor)
-
handle
public <U> java.util.concurrent.CompletableFuture<U> handle(java.util.function.BiFunction<? super T,java.lang.Throwable,? extends U> fn)
-
handleAsync
public <U> java.util.concurrent.CompletableFuture<U> handleAsync(java.util.function.BiFunction<? super T,java.lang.Throwable,? extends U> fn)
-
handleAsync
public <U> java.util.concurrent.CompletableFuture<U> handleAsync(java.util.function.BiFunction<? super T,java.lang.Throwable,? extends U> fn, java.util.concurrent.Executor executor)
-
-