|
||||||||||
| 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.IncrementalTaskController<I,R>
edu.rice.cs.plt.concurrent.ProcessIncrementalTaskController<I,R>
public class ProcessIncrementalTaskController<I,R>
A TaskController that executes an IncrementalTask in another Java process. The task and its results must
be serializable. If the task completes successfully, the remote process is allowed to run indefinitely
(the process terminates automatically for simple tasks, but if additional non-daemon threads are spawned,
users are responsible for cleaning up the process). If the task is unsuccessful, the remote process
is immediately destroyed. A local task, scheduled by an Executor, manages the startup of and exchange
of information with the remote process. This local 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, but
no process will ever by spawned.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class edu.rice.cs.plt.concurrent.IncrementalTaskController |
|---|
IncrementalTaskController.CanceledPausingState, IncrementalTaskController.FreshPausingState, IncrementalTaskController.PausedStartingState, IncrementalTaskController.PausedState, IncrementalTaskController.PausingState, IncrementalTaskController.StartedPausingState |
| Field Summary |
|---|
| Fields inherited from class edu.rice.cs.plt.concurrent.TaskController |
|---|
state |
| Constructor Summary | |
|---|---|
ProcessIncrementalTaskController(JVMBuilder jvmBuilder,
Executor executor,
IncrementalTask<? extends I,? extends R> task,
boolean ignoreIntermediate)
Create, but do not start, aProcessIncrementalTaskController. |
|
ProcessIncrementalTaskController(JVMBuilder jvmBuilder,
Executor executor,
IncrementalTask<? extends I,? extends R> task,
boolean ignoreIntermediate,
Runnable1<? super Process> onExit)
Create, but do not start, a ProcessIncrementalTaskController. |
|
| Method Summary | |
|---|---|
protected void |
discard()
Clean up after the task has completed. |
protected void |
doPause()
Pause computation and call IncrementalTaskController.paused(). |
protected void |
doResume()
Resume computation (after a pause) and call TaskController.started(). |
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.IncrementalTaskController |
|---|
intermediateListeners, intermediateQueue, pause, paused, stepped, steps |
| 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 ProcessIncrementalTaskController(JVMBuilder jvmBuilder,
Executor executor,
IncrementalTask<? extends I,? extends R> task,
boolean ignoreIntermediate)
jvmBuilder - A JVMBuilder for the remote process; must have this class, task's class,
and their dependencies on its class path.executor - An executor for scheduling a local task that manages interaction with the remote
process. The local task completes once a value has been returned.task - A computation to perform; the task and its return value must be serializable.ignoreIntermediate - Whether intermediate values will be discarded (but counted) rather than enqueued.
public ProcessIncrementalTaskController(JVMBuilder jvmBuilder,
Executor executor,
IncrementalTask<? extends I,? extends R> task,
boolean ignoreIntermediate,
Runnable1<? super Process> onExit)
onExit will
be run after the process finishes (which may occur in the indefinite future if the task spawns
additional non-daemon threads).
jvmBuilder - A JVMBuilder for the remote process; must have this class, task's class,
and their dependencies on its class path.executor - An executor for scheduling a local task that manages interaction with the remote
process. If onExit is defined, the local task completes after the process
terminates and onExit has run; otherwise, the local task completes once a
value has been returned.task - A computation to perform; the task and its return value must be serializable.ignoreIntermediate - Whether intermediate values will be discarded (but counted) rather than enqueued.onExit - An action to perform when the process has quit, or null for no action.| 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 doPause()
IncrementalTaskControllerIncrementalTaskController.paused(). If pausing does not occur immediately, the paused()
call may occur in a different thread. Will only be called after started() has been invoked.
When execution should resume again, doStart() will be invoked (but only after paused()
has been called). In order to support responsive canceling, a call to doStop() may occur
concurrently, or before paused() is called.
doPause in class IncrementalTaskController<I,R>protected void doResume()
IncrementalTaskControllerTaskController.started(). If starting does not occur immediately
(for example, blocking occurs first), the started() call may occur in a different thread.
doResume in class IncrementalTaskController<I,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 | |||||||||