public class OldController
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
protected static class |
OldController.Suspender
actual class that will block a model's execution.
|
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<IModel,java.util.concurrent.ExecutorService> |
_executors |
protected java.util.concurrent.locks.ReentrantLock |
_lock |
protected java.util.concurrent.locks.Condition |
_resume |
protected java.util.Set<IModel> |
_runningModels |
protected java.util.concurrent.locks.Condition |
_start |
protected java.util.concurrent.locks.Condition |
_stop |
protected java.util.concurrent.locks.Condition |
_suspend |
protected java.util.Set<IModel> |
_suspendedModels |
protected boolean |
_suspendOnStart |
protected java.util.Map<IModel,OldController.Suspender> |
_suspensionState |
protected java.util.Set<IModel> |
_terminatedModels |
Constructor and Description |
---|
OldController() |
Modifier and Type | Method and Description |
---|---|
void |
attach()
attach this controller to the runtime.
|
protected java.util.concurrent.ExecutorService |
createExecutorService(IModel model)
create the executor service that will run the model.
|
protected IModelListener |
createModelListener()
create the model listener that will be used to controller the model.
|
protected java.lang.Runnable |
createModelRunner(IModel model,
java.util.concurrent.ExecutorService service)
override to provide ProfilingModelRunner if you'd like to track performance
stats
|
protected IACTRRuntimeListener |
createRuntimeListener()
create the runtime listener that handles controller signalling.
|
protected void |
destroyExecutorService(java.util.concurrent.ExecutorService service,
IModel model)
destory the executor service.
|
protected void |
destroyModelRunner(java.lang.Runnable runner,
IModel model)
if you override instantiateModelRunner and need to clean up said runner,
clean up here
|
void |
detach()
detach from the runtime.
|
protected IModelListener |
getModelListener()
return the model listener that we use in order to control execution
|
java.util.Collection<IModel> |
getRunningModels()
return all the models that are currently running
|
protected IACTRRuntimeListener |
getRuntimeListener()
return the runtime listener that we use in order to signal the controller
events (awake from wait)
|
java.util.Collection<IModel> |
getSuspendedModels()
return all the models that are suspended
|
protected OldController.Suspender |
getSuspender(IModel model)
return the suspender which is responsible for flaging a model for
suspension, doing it and propogating the events.
|
java.util.Collection<IModel> |
getTerminatedModels()
return all the models that have termianted
|
boolean |
isRunning() |
protected boolean |
isRunning(IModel model)
is this model running?
|
boolean |
isSuspended() |
protected boolean |
isSuspended(IModel model)
is this model suspended
|
void |
reset()
reset a competed runtime to its prefrun state
|
void |
resume()
request that a suspended runtime resume
|
protected void |
resumeModel(IModel model)
request that this model resume
|
void |
setSuspendImmediately(boolean suspendImmediately)
if true, after start() is called, the models will immediately suspend
|
void |
start() |
void |
start(boolean suspendImmediately)
this will fire the onStart if present, signal the start of the runtime and
then start the models
|
protected void |
startModel(IModel model,
boolean suspendOnStart)
actually start the model
|
void |
stop()
request that everyone stop.
|
protected void |
stopModel(IModel model)
force the model to stop
|
void |
suspend()
request that everyone suspend
|
protected void |
suspendModel(IModel model)
request that this model be suspended
|
java.util.concurrent.Future<java.lang.Boolean> |
terminate() |
void |
waitForCompletion() |
void |
waitForResumption() |
void |
waitForStart() |
void |
waitForSuspension() |
protected java.util.Set<IModel> _runningModels
protected java.util.Set<IModel> _terminatedModels
protected java.util.Set<IModel> _suspendedModels
protected java.util.Map<IModel,OldController.Suspender> _suspensionState
protected boolean _suspendOnStart
protected java.util.Map<IModel,java.util.concurrent.ExecutorService> _executors
protected java.util.concurrent.locks.ReentrantLock _lock
protected java.util.concurrent.locks.Condition _start
protected java.util.concurrent.locks.Condition _stop
protected java.util.concurrent.locks.Condition _suspend
protected java.util.concurrent.locks.Condition _resume
protected final IModelListener getModelListener()
protected final IACTRRuntimeListener getRuntimeListener()
protected IModelListener createModelListener()
protected IACTRRuntimeListener createRuntimeListener()
public final void setSuspendImmediately(boolean suspendImmediately)
suspendImmediately
- public final java.util.Collection<IModel> getRunningModels()
IController.getRunningModels()
public final java.util.Collection<IModel> getSuspendedModels()
IController.getSuspendedModels()
public final java.util.Collection<IModel> getTerminatedModels()
IController.getTerminatedModels()
protected final OldController.Suspender getSuspender(IModel model)
model
- public final boolean isRunning()
IController.isRunning()
public final boolean isSuspended()
IController.isSuspended()
public final void reset()
org.jactr.core.runtime.controller.IController#reset()
public final void resume()
IController.resume()
public void attach()
IController.attach()
public void detach()
IController.detach()
public final void start()
IController.start()
public final void start(boolean suspendImmediately)
IController.start(boolean)
public final void stop()
IController.stop()
public java.util.concurrent.Future<java.lang.Boolean> terminate()
public final void suspend()
IController.suspend()
public final void waitForCompletion() throws java.lang.InterruptedException
java.lang.InterruptedException
IController.waitForCompletion()
public final void waitForResumption() throws java.lang.InterruptedException
java.lang.InterruptedException
IController.waitForResumption()
public final void waitForSuspension() throws java.lang.InterruptedException
java.lang.InterruptedException
IController.waitForSuspension()
public final void waitForStart() throws java.lang.InterruptedException
java.lang.InterruptedException
protected java.lang.Runnable createModelRunner(IModel model, java.util.concurrent.ExecutorService service)
model
- service
- protected void destroyModelRunner(java.lang.Runnable runner, IModel model)
runner
- model
- protected java.util.concurrent.ExecutorService createExecutorService(IModel model)
model
- protected void destroyExecutorService(java.util.concurrent.ExecutorService service, IModel model)
service
- model
- protected final void startModel(IModel model, boolean suspendOnStart)
model
- suspendOnStart
- protected final void stopModel(IModel model)
protected final boolean isRunning(IModel model)
model
- protected final boolean isSuspended(IModel model)
model
- protected final void suspendModel(IModel model)
model
- protected final void resumeModel(IModel model)