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>

public class DefaultAsyncFutureTask<T> extends DefaultAsyncFuture<T> implements RunnableFuture<T>
Wraps a Callable in a FutureTask and make it notify a DefaultAsyncFuture.
  • Constructor Details

    • DefaultAsyncFutureTask

      public DefaultAsyncFutureTask(Callable<T> callable, boolean cancellable)
      Wrap a callable in an AsyncFuture. This constructor does not execute the callable so run() will need to be executed.
      Parameters:
      callable -
      cancellable -
    • DefaultAsyncFutureTask

      public 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.
      Parameters:
      executor -
      callable -
      cancellable -
    • DefaultAsyncFutureTask

      public DefaultAsyncFutureTask(Executor executor, Callable<T> callable, boolean cancellable)
  • 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 interface Runnable
      Specified by:
      run in interface RunnableFuture<T>
    • cancel

      public boolean cancel(boolean mayInterruptIfRunning)
      Specified by:
      cancel in interface Future<T>
      Overrides:
      cancel in class DefaultAsyncFuture<T>
      See Also: