org.lsst.ccs.bus.jgroups
Class JGroupsBusMessagingLayer
java.lang.Object
org.lsst.ccs.bus.jgroups.JGroupsBusMessagingLayer
- All Implemented Interfaces:
- Closeable, BusMessagingLayer
public class JGroupsBusMessagingLayer
- extends Object
- implements BusMessagingLayer
Each Bus is represented by a JGroups cluster.
Each agent creates a JChannel, setName to name of agent and connect to corresponding Bus/cluster
(so each agent may have up to 3 JChannel connected).
Each of these 3 channels have a JGroups Address.
for sending messages to an agent we have to find its Address in the group
AND we have to find the addresses of the multiple anonymous agents that will receive a copy
There is a dictionary to match agent name to jGroups Address.
for each agent there is an Address except for anonymous agent that can be matched to multiple adresses.
ImPortant every Jchannel in the JVM MUST be closed!
|
Method Summary |
void |
addMessageListener(String agentName,
BusMessageForwarder forwarder,
Bus... buses)
|
void |
close()
|
void |
closeFor(String agentName,
Bus... buses)
|
void |
register(String agentName,
Bus... buses)
|
void |
removeMessageListener(String agentName,
BusMessageForwarder forwarder,
Bus... buses)
|
|
sendMessage(String senderAgent,
Bus<T> bus,
T message,
String... destinations)
|
void |
setMembershipListener(BusMembershipListener listener,
Bus... buses)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_UDP_PROTOCOL
public static final String DEFAULT_UDP_PROTOCOL
- See Also:
- Constant Field Values
DEFAULT_UDP_PROPERTIES
public static final String DEFAULT_UDP_PROPERTIES
- See Also:
- Constant Field Values
DEFAULT_TCP_PROTOCOL
public static final String DEFAULT_TCP_PROTOCOL
- See Also:
- Constant Field Values
DEFAULT_TCP_PROPERTIES
public static final String DEFAULT_TCP_PROPERTIES
- See Also:
- Constant Field Values
JGroupsBusMessagingLayer
@Deprecated
public JGroupsBusMessagingLayer()
- Deprecated.
- there should be only one instance perJVM: it's up to the calling code
to check that.
register
public void register(String agentName,
Bus... buses)
throws IOException
- Specified by:
register in interface BusMessagingLayer
- Throws:
IOException
closeFor
public void closeFor(String agentName,
Bus... buses)
- Specified by:
closeFor in interface BusMessagingLayer
close
public void close()
throws IOException
- Specified by:
close in interface Closeable- Specified by:
close in interface BusMessagingLayer
- Throws:
IOException
sendMessage
public <T extends BusPayload> void sendMessage(String senderAgent,
Bus<T> bus,
T message,
String... destinations)
throws IOException
- Specified by:
sendMessage in interface BusMessagingLayer
- Throws:
IOException
addMessageListener
public void addMessageListener(String agentName,
BusMessageForwarder forwarder,
Bus... buses)
- Specified by:
addMessageListener in interface BusMessagingLayer
removeMessageListener
public void removeMessageListener(String agentName,
BusMessageForwarder forwarder,
Bus... buses)
- Specified by:
removeMessageListener in interface BusMessagingLayer
setMembershipListener
public void setMembershipListener(BusMembershipListener listener,
Bus... buses)
- Specified by:
setMembershipListener in interface BusMessagingLayer
Copyright © 2012 LSST. All Rights Reserved.