Package org.onlab.util
Class BlockingAwareFuture<T>
- java.lang.Object
-
- java.util.concurrent.CompletableFuture<T>
-
- org.onlab.util.BlockingAwareFuture<T>
-
- All Implemented Interfaces:
CompletionStage<T>,Future<T>
public class BlockingAwareFuture<T> extends CompletableFuture<T>
ACompletableFuturethat tracks whether the future or one of its descendants has been blocked on aCompletableFuture.get()orCompletableFuture.join()call.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.util.concurrent.CompletableFuture
CompletableFuture.AsynchronousCompletionTask
-
-
Constructor Summary
Constructors Constructor Description BlockingAwareFuture()
-
Method Summary
-
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 InterruptedException, ExecutionException
- Specified by:
getin interfaceFuture<T>- Overrides:
getin classCompletableFuture<T>- Throws:
InterruptedExceptionExecutionException
-
get
public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
- Specified by:
getin interfaceFuture<T>- Overrides:
getin classCompletableFuture<T>- Throws:
InterruptedExceptionExecutionExceptionTimeoutException
-
join
public T join()
- Overrides:
joinin classCompletableFuture<T>
-
thenApply
public <U> CompletableFuture<U> thenApply(Function<? super T,? extends U> fn)
- Specified by:
thenApplyin interfaceCompletionStage<T>- Overrides:
thenApplyin classCompletableFuture<T>
-
thenApplyAsync
public <U> CompletableFuture<U> thenApplyAsync(Function<? super T,? extends U> fn)
- Specified by:
thenApplyAsyncin interfaceCompletionStage<T>- Overrides:
thenApplyAsyncin classCompletableFuture<T>
-
thenApplyAsync
public <U> CompletableFuture<U> thenApplyAsync(Function<? super T,? extends U> fn, Executor executor)
- Specified by:
thenApplyAsyncin interfaceCompletionStage<T>- Overrides:
thenApplyAsyncin classCompletableFuture<T>
-
thenAccept
public CompletableFuture<Void> thenAccept(Consumer<? super T> action)
- Specified by:
thenAcceptin interfaceCompletionStage<T>- Overrides:
thenAcceptin classCompletableFuture<T>
-
thenAcceptAsync
public CompletableFuture<Void> thenAcceptAsync(Consumer<? super T> action)
- Specified by:
thenAcceptAsyncin interfaceCompletionStage<T>- Overrides:
thenAcceptAsyncin classCompletableFuture<T>
-
thenAcceptAsync
public CompletableFuture<Void> thenAcceptAsync(Consumer<? super T> action, Executor executor)
- Specified by:
thenAcceptAsyncin interfaceCompletionStage<T>- Overrides:
thenAcceptAsyncin classCompletableFuture<T>
-
thenRun
public CompletableFuture<Void> thenRun(Runnable action)
- Specified by:
thenRunin interfaceCompletionStage<T>- Overrides:
thenRunin classCompletableFuture<T>
-
thenRunAsync
public CompletableFuture<Void> thenRunAsync(Runnable action)
- Specified by:
thenRunAsyncin interfaceCompletionStage<T>- Overrides:
thenRunAsyncin classCompletableFuture<T>
-
thenRunAsync
public CompletableFuture<Void> thenRunAsync(Runnable action, Executor executor)
- Specified by:
thenRunAsyncin interfaceCompletionStage<T>- Overrides:
thenRunAsyncin classCompletableFuture<T>
-
thenCombine
public <U,V> CompletableFuture<V> thenCombine(CompletionStage<? extends U> other, BiFunction<? super T,? super U,? extends V> fn)
- Specified by:
thenCombinein interfaceCompletionStage<T>- Overrides:
thenCombinein classCompletableFuture<T>
-
thenCombineAsync
public <U,V> CompletableFuture<V> thenCombineAsync(CompletionStage<? extends U> other, BiFunction<? super T,? super U,? extends V> fn)
- Specified by:
thenCombineAsyncin interfaceCompletionStage<T>- Overrides:
thenCombineAsyncin classCompletableFuture<T>
-
thenCombineAsync
public <U,V> CompletableFuture<V> thenCombineAsync(CompletionStage<? extends U> other, BiFunction<? super T,? super U,? extends V> fn, Executor executor)
- Specified by:
thenCombineAsyncin interfaceCompletionStage<T>- Overrides:
thenCombineAsyncin classCompletableFuture<T>
-
thenAcceptBoth
public <U> CompletableFuture<Void> thenAcceptBoth(CompletionStage<? extends U> other, BiConsumer<? super T,? super U> action)
- Specified by:
thenAcceptBothin interfaceCompletionStage<T>- Overrides:
thenAcceptBothin classCompletableFuture<T>
-
thenAcceptBothAsync
public <U> CompletableFuture<Void> thenAcceptBothAsync(CompletionStage<? extends U> other, BiConsumer<? super T,? super U> action)
- Specified by:
thenAcceptBothAsyncin interfaceCompletionStage<T>- Overrides:
thenAcceptBothAsyncin classCompletableFuture<T>
-
thenAcceptBothAsync
public <U> CompletableFuture<Void> thenAcceptBothAsync(CompletionStage<? extends U> other, BiConsumer<? super T,? super U> action, Executor executor)
- Specified by:
thenAcceptBothAsyncin interfaceCompletionStage<T>- Overrides:
thenAcceptBothAsyncin classCompletableFuture<T>
-
runAfterBoth
public CompletableFuture<Void> runAfterBoth(CompletionStage<?> other, Runnable action)
- Specified by:
runAfterBothin interfaceCompletionStage<T>- Overrides:
runAfterBothin classCompletableFuture<T>
-
runAfterBothAsync
public CompletableFuture<Void> runAfterBothAsync(CompletionStage<?> other, Runnable action)
- Specified by:
runAfterBothAsyncin interfaceCompletionStage<T>- Overrides:
runAfterBothAsyncin classCompletableFuture<T>
-
runAfterBothAsync
public CompletableFuture<Void> runAfterBothAsync(CompletionStage<?> other, Runnable action, Executor executor)
- Specified by:
runAfterBothAsyncin interfaceCompletionStage<T>- Overrides:
runAfterBothAsyncin classCompletableFuture<T>
-
applyToEither
public <U> CompletableFuture<U> applyToEither(CompletionStage<? extends T> other, Function<? super T,U> fn)
- Specified by:
applyToEitherin interfaceCompletionStage<T>- Overrides:
applyToEitherin classCompletableFuture<T>
-
applyToEitherAsync
public <U> CompletableFuture<U> applyToEitherAsync(CompletionStage<? extends T> other, Function<? super T,U> fn)
- Specified by:
applyToEitherAsyncin interfaceCompletionStage<T>- Overrides:
applyToEitherAsyncin classCompletableFuture<T>
-
applyToEitherAsync
public <U> CompletableFuture<U> applyToEitherAsync(CompletionStage<? extends T> other, Function<? super T,U> fn, Executor executor)
- Specified by:
applyToEitherAsyncin interfaceCompletionStage<T>- Overrides:
applyToEitherAsyncin classCompletableFuture<T>
-
acceptEither
public CompletableFuture<Void> acceptEither(CompletionStage<? extends T> other, Consumer<? super T> action)
- Specified by:
acceptEitherin interfaceCompletionStage<T>- Overrides:
acceptEitherin classCompletableFuture<T>
-
acceptEitherAsync
public CompletableFuture<Void> acceptEitherAsync(CompletionStage<? extends T> other, Consumer<? super T> action)
- Specified by:
acceptEitherAsyncin interfaceCompletionStage<T>- Overrides:
acceptEitherAsyncin classCompletableFuture<T>
-
acceptEitherAsync
public CompletableFuture<Void> acceptEitherAsync(CompletionStage<? extends T> other, Consumer<? super T> action, Executor executor)
- Specified by:
acceptEitherAsyncin interfaceCompletionStage<T>- Overrides:
acceptEitherAsyncin classCompletableFuture<T>
-
runAfterEither
public CompletableFuture<Void> runAfterEither(CompletionStage<?> other, Runnable action)
- Specified by:
runAfterEitherin interfaceCompletionStage<T>- Overrides:
runAfterEitherin classCompletableFuture<T>
-
runAfterEitherAsync
public CompletableFuture<Void> runAfterEitherAsync(CompletionStage<?> other, Runnable action)
- Specified by:
runAfterEitherAsyncin interfaceCompletionStage<T>- Overrides:
runAfterEitherAsyncin classCompletableFuture<T>
-
runAfterEitherAsync
public CompletableFuture<Void> runAfterEitherAsync(CompletionStage<?> other, Runnable action, Executor executor)
- Specified by:
runAfterEitherAsyncin interfaceCompletionStage<T>- Overrides:
runAfterEitherAsyncin classCompletableFuture<T>
-
thenCompose
public <U> CompletableFuture<U> thenCompose(Function<? super T,? extends CompletionStage<U>> fn)
- Specified by:
thenComposein interfaceCompletionStage<T>- Overrides:
thenComposein classCompletableFuture<T>
-
thenComposeAsync
public <U> CompletableFuture<U> thenComposeAsync(Function<? super T,? extends CompletionStage<U>> fn)
- Specified by:
thenComposeAsyncin interfaceCompletionStage<T>- Overrides:
thenComposeAsyncin classCompletableFuture<T>
-
thenComposeAsync
public <U> CompletableFuture<U> thenComposeAsync(Function<? super T,? extends CompletionStage<U>> fn, Executor executor)
- Specified by:
thenComposeAsyncin interfaceCompletionStage<T>- Overrides:
thenComposeAsyncin classCompletableFuture<T>
-
whenComplete
public CompletableFuture<T> whenComplete(BiConsumer<? super T,? super Throwable> action)
- Specified by:
whenCompletein interfaceCompletionStage<T>- Overrides:
whenCompletein classCompletableFuture<T>
-
whenCompleteAsync
public CompletableFuture<T> whenCompleteAsync(BiConsumer<? super T,? super Throwable> action)
- Specified by:
whenCompleteAsyncin interfaceCompletionStage<T>- Overrides:
whenCompleteAsyncin classCompletableFuture<T>
-
whenCompleteAsync
public CompletableFuture<T> whenCompleteAsync(BiConsumer<? super T,? super Throwable> action, Executor executor)
- Specified by:
whenCompleteAsyncin interfaceCompletionStage<T>- Overrides:
whenCompleteAsyncin classCompletableFuture<T>
-
handle
public <U> CompletableFuture<U> handle(BiFunction<? super T,Throwable,? extends U> fn)
- Specified by:
handlein interfaceCompletionStage<T>- Overrides:
handlein classCompletableFuture<T>
-
handleAsync
public <U> CompletableFuture<U> handleAsync(BiFunction<? super T,Throwable,? extends U> fn)
- Specified by:
handleAsyncin interfaceCompletionStage<T>- Overrides:
handleAsyncin classCompletableFuture<T>
-
handleAsync
public <U> CompletableFuture<U> handleAsync(BiFunction<? super T,Throwable,? extends U> fn, Executor executor)
- Specified by:
handleAsyncin interfaceCompletionStage<T>- Overrides:
handleAsyncin classCompletableFuture<T>
-
-