|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.rice.cs.plt.concurrent.TaskController<R>
edu.rice.cs.plt.concurrent.ExecutorTaskController<R>
public class ExecutorTaskController<R>
A TaskController for a simple task, which is scheduled for execution by an Executor. To support
canceling, the task should respond to an interrupt by throwing an InterruptedException, wrapped by a
WrappedException. The task is submitted (via Executor.execute(java.lang.Runnable)) when start() is
invoked (if the executor blocks, so will start()); its status is changed to "running" when it
actually begins executing; if canceled in the interim, the status will still be "paused" until the
task begins its scheduled execution.
| Nested Class Summary |
|---|
| Field Summary |
|---|
| Fields inherited from class edu.rice.cs.plt.concurrent.TaskController |
|---|
state |
| Constructor Summary | |
|---|---|
ExecutorTaskController(java.util.concurrent.Executor executor,
Thunk<? extends R> task)
|
|
| Method Summary | |
|---|---|
protected void |
discard()
Clean up after the task has completed. |
protected void |
doStart()
Begin computation and call TaskController.started(). |
protected void |
doStop()
Terminate computation and call TaskController.stopped(). |
| Methods inherited from class edu.rice.cs.plt.concurrent.TaskController |
|---|
attemptGet, attemptGet, cancel, cancel, finishedCleanly, finishedWithImplementationException, finishedWithTaskException, finishListeners, get, get, get, hasValue, isCanceled, isCancelled, isDone, isResolved, runningState, start, started, status, stopped, value |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ExecutorTaskController(java.util.concurrent.Executor executor,
Thunk<? extends R> task)
| Method Detail |
|---|
protected void doStart()
TaskControllerTaskController.started(). If starting does not occur immediately (for example,
blocking occurs first), the started() call may occur in a different thread.
doStart in class TaskController<R>protected void doStop()
TaskControllerTaskController.stopped(). Never called before started() has been
invoked. If termination does not occur immediately (for example, blocking occurs first), the
stopped() call may occur in a different thread.
doStop in class TaskController<R>protected void discard()
TaskControllerfinishedCleanly() has been called, or when cancel() is
invoked on a PAUSED controller). By default, does nothing, but can be overridden to close
connections or throw away unnecessary objects. (Where TaskControllers live far beyond their computation
life span (as simple wrappers for a value), this allows objects related to the computation to be
garbage-collected in the interim.)
discard in class TaskController<R>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||