You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by rf...@apache.org on 2009/12/10 02:09:59 UTC
svn commit: r889045 -
/tuscany/sca-java-2.x/trunk/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistry.java
Author: rfeng
Date: Thu Dec 10 01:09:59 2009
New Revision: 889045
URL: http://svn.apache.org/viewvc?rev=889045&view=rev
Log:
Set the static member port to be the same as the receiver port, see http://www.mail-archive.com/users@tomcat.apache.org/msg24873.html
Modified:
tuscany/sca-java-2.x/trunk/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistry.java
Modified: tuscany/sca-java-2.x/trunk/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistry.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistry.java?rev=889045&r1=889044&r2=889045&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistry.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistry.java Thu Dec 10 01:09:59 2009
@@ -78,7 +78,7 @@
private String id;
private boolean noMultiCast;
- private static final Channel createChannel(String address, int port, String bindAddress) {
+ private static final GroupChannel createChannel(String address, int port, String bindAddress) {
//create a channel
GroupChannel channel = new GroupChannel();
@@ -95,7 +95,7 @@
} else {
mcastService.setBind(getBindAddress());
}
-
+
return channel;
}
@@ -179,26 +179,31 @@
if (map != null) {
throw new IllegalStateException("The registry has already been started");
}
+ GroupChannel channel = createChannel(address, port, bind);
map =
- new ReplicatedMap(null, createChannel(address, port, bind), timeout, this.domainURI,
+ new ReplicatedMap(null, channel, timeout, this.domainURI,
new ClassLoader[] {ReplicatedEndpointRegistry.class.getClassLoader()});
map.addListener(this);
if (noMultiCast) {
map.getChannel().addInterceptor(new DisableMcastInterceptor());
}
-
+
+ // http://www.mail-archive.com/users@tomcat.apache.org/msg24873.html
+ int port = channel.getChannelReceiver().getPort();
+
if (staticRoutes != null) {
StaticMembershipInterceptor smi = new StaticMembershipInterceptor();
for (URI staticRoute : staticRoutes) {
Member member;
try {
- member = new StaticMember(staticRoute.getHost(), staticRoute.getPort(), 5000);
+ // The port has to match the receiver port
+ member = new StaticMember(staticRoute.getHost(), port, 5000);
} catch (IOException e) {
throw new RuntimeException(e);
}
smi.addStaticMember(member);
- logger.info("Added static route: " + staticRoute.getHost() + ":" + staticRoute.getPort());
+ logger.info("Added static route: " + staticRoute.getHost() + ":" + port);
}
smi.setLocalMember(map.getChannel().getLocalMember(false));
map.getChannel().addInterceptor(smi);