org.lsst.ccs.bus.jgroups
Class JGroupsBusMessagingLayer

java.lang.Object
  extended by org.lsst.ccs.bus.jgroups.JGroupsBusMessagingLayer
All Implemented Interfaces:
Closeable, org.lsst.ccs.bus.BusMessagingLayer

public class JGroupsBusMessagingLayer
extends Object
implements org.lsst.ccs.bus.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!


Field Summary
static String DEFAULT_TCP_PROPERTIES
           
static String DEFAULT_TCP_PROTOCOL
           
static String DEFAULT_UDP_PROPERTIES
           
static String DEFAULT_UDP_PROTOCOL
           
 
Fields inherited from interface org.lsst.ccs.bus.BusMessagingLayer
ANONYMOUS_AGENT
 
Constructor Summary
JGroupsBusMessagingLayer()
          Deprecated. 
 
Method Summary
 void addMessageListener(String agentName, org.lsst.ccs.bus.BusMessageForwarder forwarder, org.lsst.ccs.bus.Bus... buses)
           
 void close()
           
 void closeFor(String agentName, org.lsst.ccs.bus.Bus... buses)
           
 void register(String agentName, org.lsst.ccs.bus.Bus... buses)
           
 void removeMessageListener(String agentName, org.lsst.ccs.bus.BusMessageForwarder forwarder, org.lsst.ccs.bus.Bus... buses)
           
<T extends org.lsst.ccs.bus.BusPayload>
void
sendMessage(String senderAgent, org.lsst.ccs.bus.Bus<T> bus, T message, String... destinations)
           
 void setMembershipListener(org.lsst.ccs.bus.BusMembershipListener listener, org.lsst.ccs.bus.Bus... buses)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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
Constructor Detail

JGroupsBusMessagingLayer

@Deprecated
public JGroupsBusMessagingLayer()
Deprecated. 

there should be only one instance perJVM: it's up to the calling code to check that.

Method Detail

register

public void register(String agentName,
                     org.lsst.ccs.bus.Bus... buses)
              throws IOException
Specified by:
register in interface org.lsst.ccs.bus.BusMessagingLayer
Throws:
IOException

closeFor

public void closeFor(String agentName,
                     org.lsst.ccs.bus.Bus... buses)
Specified by:
closeFor in interface org.lsst.ccs.bus.BusMessagingLayer

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Specified by:
close in interface org.lsst.ccs.bus.BusMessagingLayer
Throws:
IOException

sendMessage

public <T extends org.lsst.ccs.bus.BusPayload> void sendMessage(String senderAgent,
                                                                org.lsst.ccs.bus.Bus<T> bus,
                                                                T message,
                                                                String... destinations)
                 throws IOException
Specified by:
sendMessage in interface org.lsst.ccs.bus.BusMessagingLayer
Throws:
IOException

addMessageListener

public void addMessageListener(String agentName,
                               org.lsst.ccs.bus.BusMessageForwarder forwarder,
                               org.lsst.ccs.bus.Bus... buses)
Specified by:
addMessageListener in interface org.lsst.ccs.bus.BusMessagingLayer

removeMessageListener

public void removeMessageListener(String agentName,
                                  org.lsst.ccs.bus.BusMessageForwarder forwarder,
                                  org.lsst.ccs.bus.Bus... buses)
Specified by:
removeMessageListener in interface org.lsst.ccs.bus.BusMessagingLayer

setMembershipListener

public void setMembershipListener(org.lsst.ccs.bus.BusMembershipListener listener,
                                  org.lsst.ccs.bus.Bus... buses)
Specified by:
setMembershipListener in interface org.lsst.ccs.bus.BusMessagingLayer


Copyright © 2012 LSST. All Rights Reserved.