|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.excalibur.event.command.CommandManager
The CommandManager handles asynchronous commands from the rest of the system. The only exposed piece is the Queue 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 CommandManager will use // ThreadManager threadManager = new TPCThreadManager(); threadManager.enableLogging( getLogger().getChildLogger("threadmanager") ); Parameters params = new Parameters(); params.setParameter( "threads-per-processor", "2" ); params.setParameter( "sleep-time", "1000" ); params.setParameter( "block-timeout", "250" ); threadManager.parameterize( params ); threadManager.initialize(); // // Set up the CommandManager // CommandManager commandManager = new CommandManager(); threadManager.register( commandManager );
Constructor Summary | |
CommandManager()
Create the CommandManager |
Method Summary | |
void |
deregisterSignalHandler(Signal signal,
EventHandler handler)
Deregister a Signal with an EventHandler. |
void |
dispose()
When you are done with CommandManager, call this and it will clean up all its resources. |
Sink |
getCommandSink()
Get the Command Sink so that you can enqueue new commands. |
EventHandler |
getEventHandler()
Used by the ThreadManager to get the EventHandler for the CommandManager. |
Source[] |
getSources()
Used by the Threadmanager to get the sources that are feeding the CommandManager. |
void |
registerSignalHandler(Signal signal,
EventHandler handler)
Register a Signal with an EventHandler. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public CommandManager()
Method Detail |
public final Sink getCommandSink()
public final void registerSignalHandler(Signal signal, EventHandler handler)
Signal
interface. When CommandManager recieves
events that match the Signal, it will send a copy of it to all the
EventHandler
s attached to it.
signal
- The signal we are listening for.handler
- The handler that wants to be notifiedpublic final void deregisterSignalHandler(Signal signal, EventHandler handler)
signal
- The signal we are listening for.handler
- The handler that wants to be notifiedpublic void dispose()
dispose
in interface Disposable
public final Source[] getSources()
getSources
in interface EventPipeline
public final EventHandler getEventHandler()
getEventHandler
in interface EventPipeline
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |