de.intarsys.tools.concurrent
Class AbstractFutureTask<R>

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

public abstract class AbstractFutureTask<R>
extends java.lang.Object
implements java.lang.Runnable, java.util.concurrent.Future

This is an alternate implementation for FutureTask, which is in some cases not flexible enough.


Field Summary
protected static java.util.logging.Logger Log
           
 
Constructor Summary
protected AbstractFutureTask()
           
 
Method Summary
protected  java.lang.Throwable basicGetException()
           
protected  R basicGetResult()
           
 boolean cancel(boolean interrupt)
           
protected abstract  R compute()
           
protected  void computeAsync()
           
 R get()
           
 R get(long pMillisecTimeout, java.util.concurrent.TimeUnit unit)
           
 java.lang.Throwable getException()
           
protected  void handleException()
           
protected  void handleFinally()
           
protected  void handleResult()
           
 boolean isActive()
           
 boolean isCancelled()
           
 boolean isDone()
           
 boolean isFailed()
           
 void reset()
           
 void run()
           
 void runAsync()
           
protected  void setException(java.lang.Throwable e)
           
protected  void setResult(R object)
           
protected  void taskCancelled()
           
protected  void taskFailed()
           
protected  void taskFinally()
           
protected  void taskFinished()
           
protected  void taskStarted()
           
 java.lang.String toString()
           
protected  void undo()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

Log

protected static final java.util.logging.Logger Log
Constructor Detail

AbstractFutureTask

protected AbstractFutureTask()
Method Detail

basicGetException

protected java.lang.Throwable basicGetException()

basicGetResult

protected R basicGetResult()

cancel

public boolean cancel(boolean interrupt)
Specified by:
cancel in interface java.util.concurrent.Future

compute

protected abstract R compute()
                      throws java.lang.Exception
Throws:
java.lang.Exception

computeAsync

protected void computeAsync()

get

public R get()
      throws java.lang.InterruptedException,
             java.util.concurrent.ExecutionException
Specified by:
get in interface java.util.concurrent.Future
Throws:
java.lang.InterruptedException
java.util.concurrent.ExecutionException

get

public R get(long pMillisecTimeout,
             java.util.concurrent.TimeUnit unit)
      throws java.lang.InterruptedException,
             java.util.concurrent.ExecutionException,
             java.util.concurrent.TimeoutException
Specified by:
get in interface java.util.concurrent.Future
Throws:
java.lang.InterruptedException
java.util.concurrent.ExecutionException
java.util.concurrent.TimeoutException

getException

public java.lang.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 java.util.concurrent.Future

isDone

public boolean isDone()
Specified by:
isDone in interface java.util.concurrent.Future

isFailed

public boolean isFailed()

reset

public void reset()

run

public final void run()
Specified by:
run in interface java.lang.Runnable

runAsync

public void runAsync()

setException

protected void setException(java.lang.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 java.lang.String toString()
Overrides:
toString in class java.lang.Object

undo

protected void undo()