Package 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.FutureThis is an alternate implementation forFutureTask, which is in some cases not flexible enough.
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.util.logging.LoggerLog
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractFutureTask()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected java.lang.ThrowablebasicGetException()protected RbasicGetResult()booleancancel(boolean interrupt)protected abstract Rcompute()protected voidcomputeAsync()Rget()Rget(long pMillisecTimeout, java.util.concurrent.TimeUnit unit)java.lang.ThrowablegetException()protected voidhandleException()protected voidhandleFinally()protected voidhandleResult()booleanisActive()booleanisCancelled()booleanisDone()booleanisFailed()voidreset()voidrun()voidrunAsync()protected voidsetException(java.lang.Throwable e)protected voidsetResult(R object)protected voidtaskCancelled()protected voidtaskFailed()protected voidtaskFinally()protected voidtaskFinished()protected voidtaskStarted()java.lang.StringtoString()protected voidundo()
-
-
-
Method Detail
-
basicGetException
protected java.lang.Throwable basicGetException()
-
basicGetResult
protected R basicGetResult()
-
cancel
public boolean cancel(boolean interrupt)
- Specified by:
cancelin interfacejava.util.concurrent.Future<R>
-
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:
getin interfacejava.util.concurrent.Future<R>- Throws:
java.lang.InterruptedExceptionjava.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:
getin interfacejava.util.concurrent.Future<R>- Throws:
java.lang.InterruptedExceptionjava.util.concurrent.ExecutionExceptionjava.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:
isCancelledin interfacejava.util.concurrent.Future<R>
-
isDone
public boolean isDone()
- Specified by:
isDonein interfacejava.util.concurrent.Future<R>
-
isFailed
public boolean isFailed()
-
reset
public void reset()
-
run
public final void run()
- Specified by:
runin interfacejava.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:
toStringin classjava.lang.Object
-
undo
protected void undo()
-
-