de.intarsys.tools.concurrent
Class AbstractFutureTask<R>
java.lang.Object
de.intarsys.tools.concurrent.AbstractFutureTask<R>
- Type Parameters:
R -
- All Implemented Interfaces:
- Runnable, Future
- Direct Known Subclasses:
- GenericFutureTask, 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.
cancel
public boolean cancel(boolean interrupt)
- Specified by:
cancel in interface Future
get
public R get()
throws InterruptedException,
ExecutionException
- Specified by:
get in interface Future
- Throws:
InterruptedException
ExecutionException
get
public R get(long timeout,
TimeUnit unit)
throws InterruptedException,
ExecutionException,
TimeoutException
- Wait for the result. The "timeout" parameter allows to
- wait indefinite
when timeout == 0;
- wait specified duration
when timeout > 0;
- don't wait (peek)
when timeout < 0;
- Specified by:
get in interface Future
- Throws:
InterruptedException
ExecutionException
TimeoutException- See Also:
Future.get(long, java.util.concurrent.TimeUnit)
getException
public Throwable getException()
getTaskListener
public ITaskListener getTaskListener()
isActive
public boolean isActive()
isAsynch
public boolean isAsynch()
isCancelled
public boolean isCancelled()
- Specified by:
isCancelled in interface Future
isDone
public boolean isDone()
- Specified by:
isDone in interface Future
isFailed
public boolean isFailed()
reset
public void reset()
run
public final void run()
- Specified by:
run in interface Runnable
runAsync
public final void runAsync()
setAsynch
public void setAsynch(boolean asynch)
setTaskListener
public void setTaskListener(ITaskListener taskListener)
toString
public String toString()
- Overrides:
toString in class Object
Copyright © 2012 intarsys consulting GmbH. All Rights Reserved.