summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/endpoint-tribes/src/main/java
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2009-12-08 12:39:15 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2009-12-08 12:39:15 +0000
commit0e22d32a94dacd6e9e59bf69302d783a5f222f6c (patch)
treef95dcb9316198a4341916010a03fae6a5a053c07 /sca-java-2.x/trunk/modules/endpoint-tribes/src/main/java
parent97a624331263cdd5e9d99904baf633f63a062b0c (diff)
Add a quick hack to enable disabling multicast. Will need to clean up all the registry configurations once its working more properly
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@888376 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/endpoint-tribes/src/main/java')
-rw-r--r--sca-java-2.x/trunk/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistry.java18
1 files changed, 17 insertions, 1 deletions
diff --git a/sca-java-2.x/trunk/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistry.java b/sca-java-2.x/trunk/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistry.java
index ef002d5230..9dd98dedfb 100644
--- a/sca-java-2.x/trunk/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistry.java
+++ b/sca-java-2.x/trunk/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistry.java
@@ -38,11 +38,13 @@ import java.util.logging.Logger;
import org.apache.catalina.tribes.Channel;
import org.apache.catalina.tribes.ChannelException;
+import org.apache.catalina.tribes.ChannelReceiver;
import org.apache.catalina.tribes.Member;
import org.apache.catalina.tribes.group.GroupChannel;
import org.apache.catalina.tribes.group.interceptors.StaticMembershipInterceptor;
import org.apache.catalina.tribes.membership.McastService;
import org.apache.catalina.tribes.membership.StaticMember;
+import org.apache.catalina.tribes.transport.ReceiverBase;
import org.apache.tuscany.sca.assembly.Endpoint;
import org.apache.tuscany.sca.assembly.EndpointReference;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
@@ -76,6 +78,7 @@ public class ReplicatedEndpointRegistry implements EndpointRegistry, LifeCycleLi
private static List<URI> staticRoutes;
private String id;
+ private boolean noMultiCast;
private static final Channel createChannel(String address, int port, String bindAddress) {
@@ -168,6 +171,10 @@ public class ReplicatedEndpointRegistry implements EndpointRegistry, LifeCycleLi
staticRoutes.add(URI.create("tcp://" + st.nextToken()));
}
}
+ String mcast = attributes.get("nomcast");
+ if (mcast != null) {
+ noMultiCast = Boolean.valueOf(mcast);
+ }
}
public void start() {
@@ -179,6 +186,10 @@ public class ReplicatedEndpointRegistry implements EndpointRegistry, LifeCycleLi
new ClassLoader[] {ReplicatedEndpointRegistry.class.getClassLoader()});
map.addListener(this);
+ if (noMultiCast) {
+ map.getChannel().addInterceptor(new DisableMcastInterceptor());
+ }
+
if (staticRoutes != null) {
StaticMembershipInterceptor smi = new StaticMembershipInterceptor();
for (URI staticRoute : staticRoutes) {
@@ -194,7 +205,7 @@ public class ReplicatedEndpointRegistry implements EndpointRegistry, LifeCycleLi
smi.setLocalMember(map.getChannel().getLocalMember(false));
map.getChannel().addInterceptor(smi);
}
-
+
try {
map.getChannel().start(Channel.DEFAULT);
} catch (ChannelException e) {
@@ -398,6 +409,11 @@ public class ReplicatedEndpointRegistry implements EndpointRegistry, LifeCycleLi
mcastService.setPort(MULTICAST_PORT);
mcastService.setAddress(MULTICAST_ADDRESS);
+
+// ChannelReceiver rcv = channel.getChannelReceiver();
+// ReceiverBase rcvb = (ReceiverBase)rcv;
+// rcvb.setPort(10480);
+
InetAddress localhost = InetAddress.getLocalHost();
// REVIEW: In my case, there are multiple IP addresses