public class DefaultCommandManager extends java.lang.Object implements CommandManager
Source Example
// // Set up the ThreadManager that the DefaultCommandManager will use // ThreadManager threadManager = new DefaultThreadManager(); // // Set up the DefaultCommandManager // DefaultCommandManager commandManager = new DefaultCommandManager(threadManager);
| Modifier and Type | Class and Description |
|---|---|
static class |
DefaultCommandManager.DelayedCommandInfo
This class encapsulates the information needed to keep track of
our progress executing delayed and repeated commands.
|
| Modifier and Type | Field and Description |
|---|---|
private SwitchedEnqueuePredicate |
m_enqueuePredicate |
private CommandEventPipeline |
m_eventPipeline |
private ThreadManager |
m_threads |
| Constructor and Description |
|---|
DefaultCommandManager(ThreadManager manager)
Create the DefaultCommandManager using the supplied
ThreadManager.
|
| Modifier and Type | Method and Description |
|---|---|
void |
enqueueCommand(Command command)
Get the Command Sink so that you can enqueue new commands.
|
CommandFailureHandler |
getCommandFailureHandler()
Get the failure handler so that DefaultCommandManager can use it
when a problem happens.
|
int |
getEnqueuedCommandSize()
Get the number of currently enqueued commands.
|
ThreadManager |
getThreadManager()
Get the ThreadManager we are using for this CommandManager.
|
void |
setCommandFailureHandler(CommandFailureHandler handler)
Set the failure handler that the application can use to override
what happens when a command failure happens.
|
void |
start()
Start or restart the CommandManager so that it can accept more
commands.
|
void |
stop(boolean clear)
Stop the CommandManager so that it can stop accepting commands.
|
java.lang.String |
toString() |
private final SwitchedEnqueuePredicate m_enqueuePredicate
private final CommandEventPipeline m_eventPipeline
private ThreadManager m_threads
public DefaultCommandManager(ThreadManager manager)
manager - the ThreadManager to use for the command managerpublic void setCommandFailureHandler(CommandFailureHandler handler)
setCommandFailureHandler in interface CommandManagerhandler - the new Handlerjava.lang.NullPointerException - if "handler" is null.public void enqueueCommand(Command command) throws SinkException
enqueueCommand in interface CommandManagercommand - the command to enqueue and runSinkException - if the enqueue operation cannot succeedpublic void start()
CommandManagerstart in interface CommandManagerpublic void stop(boolean clear)
CommandManagerstop in interface CommandManagerclear - out currently enqueued commmands.public CommandFailureHandler getCommandFailureHandler()
public ThreadManager getThreadManager()
public int getEnqueuedCommandSize()
public java.lang.String toString()
toString in class java.lang.Object