de.intarsys.tools.concurrent
Class AbstractFutureTask<R>
java.lang.Object
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
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Log
protected static final java.util.logging.Logger Log
AbstractFutureTask
protected AbstractFutureTask()
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()