|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.d_haven.event.command.DefaultCommandManager
public class DefaultCommandManager
The DefaultCommandManager handles asynchronous commands from the rest of the system. The only exposed piece is the Pipe that other components use to give Commands to this system. You must register this with a ThreadManager for it to work.
Source Example
// // Set up the ThreadManager that the DefaultCommandManager will use // ThreadManager threadManager = new DefaultThreadManager(); // // Set up the DefaultCommandManager // DefaultCommandManager commandManager = new DefaultCommandManager(threadManager);
Nested Class Summary | |
---|---|
static class |
DefaultCommandManager.DelayedCommandInfo
This class encapsulates the information needed to keep track of our progress executing delayed and repeated commands. |
Field Summary | |
---|---|
private SwitchedEnqueuePredicate |
m_enqueuePredicate
|
private CommandEventPipeline |
m_eventPipeline
|
private ThreadManager |
m_threads
|
Constructor Summary | |
---|---|
DefaultCommandManager(ThreadManager manager)
Create the DefaultCommandManager using the supplied ThreadManager. |
Method Summary | |
---|---|
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()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private final SwitchedEnqueuePredicate m_enqueuePredicate
private final CommandEventPipeline m_eventPipeline
private ThreadManager m_threads
Constructor Detail |
---|
public DefaultCommandManager(ThreadManager manager)
manager
- the ThreadManager to use for the command managerMethod Detail |
---|
public void setCommandFailureHandler(CommandFailureHandler handler)
setCommandFailureHandler
in interface CommandManager
handler
- the new Handler
java.lang.NullPointerException
- if "handler" is null.public void enqueueCommand(Command command) throws SinkException
enqueueCommand
in interface CommandManager
command
- the command to enqueue and run
SinkException
- if the enqueue operation cannot succeedpublic void start()
CommandManager
start
in interface CommandManager
public void stop(boolean clear)
CommandManager
stop
in interface CommandManager
clear
- out currently enqueued commmands.public CommandFailureHandler getCommandFailureHandler()
public ThreadManager getThreadManager()
public int getEnqueuedCommandSize()
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |