Class DefaultAsyncFutureTask<T>
java.lang.Object
java.util.concurrent.CompletableFuture<T>
com.linkedin.alpini.base.concurrency.impl.DefaultAsyncFuture<T>
com.linkedin.alpini.base.concurrency.impl.DefaultAsyncFutureTask<T>
- All Implemented Interfaces:
AsyncFuture<T>
,AsyncPromise<T>
,Time.Awaitable
,Runnable
,CompletionStage<T>
,Future<T>
,RunnableFuture<T>
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.concurrent.CompletableFuture
CompletableFuture.AsynchronousCompletionTask
Nested classes/interfaces inherited from interface com.linkedin.alpini.base.concurrency.AsyncFuture
AsyncFuture.Status
-
Field Summary
Fields inherited from interface com.linkedin.alpini.base.concurrency.AsyncFuture
NULL_SUCCESS
-
Constructor Summary
ConstructorDescriptionDefaultAsyncFutureTask
(Callable<T> callable, boolean cancellable) Wrap a callable in an AsyncFuture.DefaultAsyncFutureTask
(Executor executor, Callable<T> callable, boolean cancellable) DefaultAsyncFutureTask
(ExecutorService executor, Callable<T> callable, boolean cancellable) Wrap a callable in an AsyncFuture and then submit it to be executed on the provided ExecutorService. -
Method Summary
Methods inherited from class com.linkedin.alpini.base.concurrency.impl.DefaultAsyncFuture
addListener, addListener, await, await, awaitUninterruptibly, awaitUninterruptibly, complete, completeExceptionally, get, getCause, getNow, isSuccess, setFailure, setSuccess
Methods inherited from class java.util.concurrent.CompletableFuture
acceptEither, acceptEitherAsync, acceptEitherAsync, allOf, anyOf, applyToEither, applyToEitherAsync, applyToEitherAsync, completeAsync, completeAsync, completedFuture, completedStage, completeOnTimeout, copy, defaultExecutor, delayedExecutor, delayedExecutor, exceptionally, exceptionallyAsync, exceptionallyAsync, exceptionallyCompose, exceptionallyComposeAsync, exceptionallyComposeAsync, failedFuture, failedStage, get, getNow, getNumberOfDependents, handle, handleAsync, handleAsync, isCancelled, isCompletedExceptionally, isDone, join, minimalCompletionStage, newIncompleteFuture, obtrudeException, obtrudeValue, orTimeout, runAfterBoth, runAfterBothAsync, runAfterBothAsync, runAfterEither, runAfterEitherAsync, runAfterEitherAsync, runAsync, runAsync, supplyAsync, supplyAsync, thenAccept, thenAcceptAsync, thenAcceptAsync, thenAcceptBoth, thenAcceptBothAsync, thenAcceptBothAsync, thenApply, thenApplyAsync, thenApplyAsync, thenCombine, thenCombineAsync, thenCombineAsync, thenCompose, thenComposeAsync, thenComposeAsync, thenRun, thenRunAsync, thenRunAsync, toCompletableFuture, toString, whenComplete, whenCompleteAsync, whenCompleteAsync
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.linkedin.alpini.base.concurrency.AsyncPromise
setComplete
Methods inherited from interface java.util.concurrent.CompletionStage
acceptEither, acceptEitherAsync, acceptEitherAsync, applyToEither, applyToEitherAsync, applyToEitherAsync, exceptionally, exceptionallyAsync, exceptionallyAsync, exceptionallyCompose, exceptionallyComposeAsync, exceptionallyComposeAsync, handle, handleAsync, handleAsync, runAfterBoth, runAfterBothAsync, runAfterBothAsync, runAfterEither, runAfterEitherAsync, runAfterEitherAsync, thenAccept, thenAcceptAsync, thenAcceptAsync, thenAcceptBoth, thenAcceptBothAsync, thenAcceptBothAsync, thenApply, thenApplyAsync, thenApplyAsync, thenCombine, thenCombineAsync, thenCombineAsync, thenCompose, thenComposeAsync, thenComposeAsync, thenRun, thenRunAsync, thenRunAsync, toCompletableFuture, whenComplete, whenCompleteAsync, whenCompleteAsync
Methods inherited from interface java.util.concurrent.Future
get, get, isCancelled, isDone
-
Constructor Details
-
DefaultAsyncFutureTask
Wrap a callable in an AsyncFuture. This constructor does not execute the callable so run() will need to be executed.- Parameters:
callable
-cancellable
-
-
DefaultAsyncFutureTask
Wrap a callable in an AsyncFuture and then submit it to be executed on the provided ExecutorService.- Parameters:
executor
-callable
-cancellable
-
-
DefaultAsyncFutureTask
-
-
Method Details
-
runAndReset
protected boolean runAndReset() -
run
public void run()Run the Callable. If the Callable has already been executed or submitted to an Executor, this may cause an IllegalStateException to be thrown.- Specified by:
run
in interfaceRunnable
- Specified by:
run
in interfaceRunnableFuture<T>
-
cancel
public boolean cancel(boolean mayInterruptIfRunning)
-