
public class CommandPresenceAgent extends Object implements StatusListener, BusMembershipListener
PingCommand that is sent to all subsystems.
Then by listening to the status bus the code is aware of responses to this "ping" and of
StatusForEnd, StatusForStart messages.
Due to the asynchronous nature of messages and to the fact that a Subsystem may die before sending a
StatusForEnd message, uses of this code may be complemented by calls to the
communication layer BusApplicationLayer.connectedToCommand() method and/or to the reset()
method in this class.| Constructor and Description |
|---|
CommandPresenceAgent(MessagingFactory fac)
creates such an agent that operates on the given bus access.
|
| Modifier and Type | Method and Description |
|---|---|
void |
anormalEvent(Exception exc)
notification of an incident (sending a message to a non-existing agent and so on)
|
void |
connecting(String agentName,
String otherInfos)
a new agent is connected to the bus
|
void |
disconnecting(String agentName,
String otherInfos)
if the communication layer notifies us of a disconnection then the corresponding agent is removed from the map.
|
List<String> |
list(boolean masters,
boolean slaves)
Returns the names of the subsystems that are presently connected to the COMMAND bus.
|
List<String> |
listAll()
return the name of all subsystems that are known to be
connected to the command bus.
|
List<String> |
listMasters() |
List<String> |
listSlaves() |
void |
onStatus(BusMessage s)
updates to the subsystem map with status messages:
responses to "ping" requests
birth or death notifications
|
void |
reset()
try to reinitialize the map of known subsystems.
|
public CommandPresenceAgent(MessagingFactory fac)
fac - public void onStatus(BusMessage s)
onStatus in interface StatusListeners - public void connecting(String agentName, String otherInfos)
BusMembershipListenerconnecting in interface BusMembershipListenerotherInfos - free form string to add comments to the eventpublic void disconnecting(String agentName, String otherInfos)
disconnecting in interface BusMembershipListeneragentName - otherInfos - public void anormalEvent(Exception exc)
BusMembershipListeneranormalEvent in interface BusMembershipListenerpublic void reset()
public List<String> list(boolean masters, boolean slaves)
BusMaster, "slave" that it is passive
(Modular subsystems executing commands). Note that some subsystems can be both (MCM)
or none of these (Databases, Tracers).masters - slaves - public List<String> listMasters()
Copyright © 2015 LSST. All rights reserved.