|
||||||||||
| 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.PollingTaskController<T>
edu.rice.cs.plt.concurrent.FutureTaskController<T>
public class FutureTaskController<T>
Treats an arbitrary Future-producing computation as a TaskController. The task is considered "started"
once the future has been created via TaskController.start() (even though some futures are not scheduled
for immediate execution — the API provides no means for determining whether a task is
actually running).
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class edu.rice.cs.plt.concurrent.PollingTaskController |
|---|
PollingTaskController.PollingCancelingState, PollingTaskController.PollingRunningState |
| Field Summary |
|---|
| Fields inherited from class edu.rice.cs.plt.concurrent.TaskController |
|---|
state |
| Constructor Summary | |
|---|---|
FutureTaskController(Thunk<? extends Future<? extends T>> futureThunk)
|
|
| 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(). |
protected void |
finish()
Block until the task is complete or this thread is interrupted. |
protected void |
finish(long timeout,
TimeUnit unit)
Block until the task is complete, this thread is interrupted, or the given timeout is reached. |
protected void |
update()
Check the current status and call the appropriate method if the task is complete. |
| Methods inherited from class edu.rice.cs.plt.concurrent.PollingTaskController |
|---|
finishListeners, runningState |
| Methods inherited from class edu.rice.cs.plt.concurrent.TaskController |
|---|
attemptGet, attemptGet, cancel, cancel, finishedCleanly, finishedWithImplementationException, finishedWithTaskException, get, get, get, hasValue, isCanceled, isCancelled, isDone, isResolved, 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 FutureTaskController(Thunk<? extends Future<? extends T>> futureThunk)
| 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<T>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<T>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<T>protected void update()
PollingTaskController
update in class PollingTaskController<T>
protected void finish()
throws InterruptedException
PollingTaskController
finish in class PollingTaskController<T>InterruptedException
protected void finish(long timeout,
TimeUnit unit)
throws InterruptedException,
TimeoutException
PollingTaskController
finish in class PollingTaskController<T>InterruptedException
TimeoutException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||