public abstract class AbstractActionEngine extends java.lang.Object implements ActionEngine
ActionEngine
that is designed to be used with
ExecutorService
. This is a convenience class for creating an ActionEngine
. awaitResumed()
).TERMINATION_TIMEOUT
,
DefaultActionBindings
Modifier and Type | Field and Description |
---|---|
protected java.util.concurrent.ExecutorService |
executorService
Executor service to be used for action scheduling.
|
static long |
TERMINATION_TIMEOUT
How long the engine will wait until it times out and interrupts running threads on shutdown
(configured via
jalse.actions.termination_timeout system property). |
Modifier | Constructor and Description |
---|---|
protected |
AbstractActionEngine(java.util.concurrent.ExecutorService executorService)
Creates a new instance of AbstractActionEngine with the supplied executor service.
|
Modifier and Type | Method and Description |
---|---|
protected void |
awaitResumed()
Will wait until the engine has resumed (or stopped).
|
ActionBindings |
getBindings()
Bindings for this engine.
|
boolean |
isPaused()
Whether the engine is paused.
|
boolean |
isStopped()
Whether the engine is stopped.
|
void |
pause()
Pauses action processing.
|
void |
resume()
Resumes performing actions.
|
void |
stop()
Permanently stops the engine.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
newContext, putInBindings, removeFromBindings, schedule, schedule
public static long TERMINATION_TIMEOUT
jalse.actions.termination_timeout
system property).protected final java.util.concurrent.ExecutorService executorService
protected AbstractActionEngine(java.util.concurrent.ExecutorService executorService)
executorService
- Service to use.Actions.requireNotShutdown(ExecutorService)
protected void awaitResumed() throws java.lang.InterruptedException
java.lang.InterruptedException
- If the current thread was interrupted.public ActionBindings getBindings()
ActionEngine
getBindings
in interface ActionEngine
public boolean isPaused()
ActionEngine
isPaused
in interface ActionEngine
public boolean isStopped()
ActionEngine
isStopped
in interface ActionEngine
public void pause()
ActionEngine
pause
in interface ActionEngine
public void resume()
ActionEngine
resume
in interface ActionEngine
public void stop()
ActionEngine
stop
in interface ActionEngine