org.lsst.ccs.utilities.dispatch
Class SynchronousCommandDispatcher<T>

java.lang.Object
  extended by org.lsst.ccs.utilities.dispatch.SynchronousCommandDispatcher<T>

public class SynchronousCommandDispatcher<T>
extends java.lang.Object

Registers codes interested in receiving commands. Each code should know that it is handling an instance of SynchronousCommandFor and should behave accordingly.

The dispatchCommand methods execute this command sequentially on each "executant" object. The order of calls is not specified.

Author:
bernard AMADE

Field Summary
protected  java.util.concurrent.CopyOnWriteArrayList<T> list
           
 
Constructor Summary
SynchronousCommandDispatcher()
           
 
Method Summary
 void addExecutant(T executant)
          Registers a code ready to receive "synchronous" commands
 void dispatchCommand(SynchronousCommandFor<? super T> command)
          Sends a command to all registered codes ready to handle it.
 void removeExecutant(T executant)
          Remove the code from the listeners list
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

list

protected java.util.concurrent.CopyOnWriteArrayList<T> list
Constructor Detail

SynchronousCommandDispatcher

public SynchronousCommandDispatcher()
Method Detail

addExecutant

public void addExecutant(T executant)
Registers a code ready to receive "synchronous" commands

Parameters:
executant -

removeExecutant

public void removeExecutant(T executant)
Remove the code from the listeners list

Parameters:
executant -

dispatchCommand

public void dispatchCommand(SynchronousCommandFor<? super T> command)
Sends a command to all registered codes ready to handle it.

If an exception is fired it is catched and logged. proper handling of Exception should be performed by the implementing commands.



Copyright © 2012 LSST. All Rights Reserved.