Class AbstractFutureTask<R>

java.lang.Object
de.intarsys.tools.concurrent.AbstractFutureTask<R>
Type Parameters:
R -
All Implemented Interfaces:
Runnable, Future
Direct Known Subclasses:
CallbackFutureTask, TaskSequence, TaskStep

public abstract class AbstractFutureTask<R> extends Object implements Runnable, Future
This is an alternate implementation for FutureTask, which is in some cases not flexible enough.
  • Field Details

    • Log

      protected static final Logger Log
  • Constructor Details

    • AbstractFutureTask

      protected AbstractFutureTask()
  • Method Details

    • basicGetException

      protected Throwable basicGetException()
    • basicGetResult

      protected R basicGetResult()
    • cancel

      public boolean cancel(boolean interrupt)
      Specified by:
      cancel in interface Future<R>
    • compute

      protected abstract R compute() throws Exception
      Throws:
      Exception
    • computeAsync

      protected void computeAsync()
    • get

      Specified by:
      get in interface Future<R>
      Throws:
      InterruptedException
      ExecutionException
    • get

      public R get(long pMillisecTimeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
      Specified by:
      get in interface Future<R>
      Throws:
      InterruptedException
      ExecutionException
      TimeoutException
    • getException

      public Throwable getException()
    • handleException

      protected final void handleException()
    • handleFinally

      protected final void handleFinally()
    • handleResult

      protected final void handleResult()
    • isActive

      public boolean isActive()
    • isCancelled

      public boolean isCancelled()
      Specified by:
      isCancelled in interface Future<R>
    • isDone

      public boolean isDone()
      Specified by:
      isDone in interface Future<R>
    • isFailed

      public boolean isFailed()
    • reset

      public void reset()
    • run

      public final void run()
      Specified by:
      run in interface Runnable
    • runAsync

      public void runAsync()
    • setException

      protected void setException(Throwable e)
    • setResult

      protected void setResult(R object)
    • taskCancelled

      protected void taskCancelled()
    • taskFailed

      protected void taskFailed()
    • taskFinally

      protected void taskFinally()
    • taskFinished

      protected void taskFinished()
    • taskStarted

      protected void taskStarted()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • undo

      protected void undo()