public class ActivityExecutor extends Object implements ParameterMap.Listener, ProgressMeter
An ActivityExecutor is a named instance of an execution harness for a single activity instance. It is responsible for managing threads and activity settings which may be changed while the activity is running.
An ActivityExecutor may be represent an activity that is defined and active in the running scenario, but which is inactive. This can occur when an activity is paused by controlling logic, or when the threads are set to zero.
Invariants:
| Constructor and Description |
|---|
ActivityExecutor(Activity activity) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitCompletion(int waitTime) |
boolean |
awaitFinish(int timeout) |
void |
forceStopExecutor(int initialMillisToWait)
Shutdown the activity executor, with a grace period for the motor threads.
|
Activity |
getActivity() |
ActivityDef |
getActivityDef() |
double |
getProgress() |
String |
getProgressName() |
RunState |
getProgressState() |
void |
handleParameterMapUpdate(ParameterMap parameterMap)
Listens for changes to parameter maps, maps them to the activity instance, and notifies
all eligible listeners of changes.
|
boolean |
isRunning() |
void |
notifyException(Thread t,
Throwable e) |
boolean |
requestStopExecutor(int secondsToWait) |
void |
startActivity()
True-up the number of motor instances known to the executor.
|
void |
stopActivity()
Simply stop the motors
|
String |
toString() |
public ActivityExecutor(Activity activity)
public void startActivity()
True-up the number of motor instances known to the executor. Start all non-running motors. The protocol between the motors and the executor should be safe as long as each state change is owned by either the motor logic or the activity executor but not both, and strictly serialized as well. This is enforced by forcing start(...) to be serialized as well as using CAS on the motor states.
The startActivity method may be called to true-up the number of active motors in an activity executor after changes to threads.
public void stopActivity()
public void forceStopExecutor(int initialMillisToWait)
initialMillisToWait - milliseconds to wait after graceful shutdownActivity request, before forcing everything to stoppublic boolean requestStopExecutor(int secondsToWait)
public void handleParameterMapUpdate(ParameterMap parameterMap)
handleParameterMapUpdate in interface ParameterMap.Listenerpublic ActivityDef getActivityDef()
public boolean awaitCompletion(int waitTime)
public boolean awaitFinish(int timeout)
public boolean isRunning()
public Activity getActivity()
public double getProgress()
getProgress in interface ProgressMeterpublic String getProgressName()
getProgressName in interface ProgressMeterpublic RunState getProgressState()
getProgressState in interface ProgressMeterCopyright © 2017. All rights reserved.