diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-12-10 01:09:59 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-12-10 01:09:59 +0000 |
commit | 67e0b53ca7d3b1c83e0ee0e3b9321bd84137d5c4 (patch) | |
tree | 235bdc67e68c3ff6e0340012fc34c4936dce75cc /sca-java-2.x/trunk/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca | |
parent | 0074fb25fc51841e4ac4c1fa02332af940bd6969 (diff) |
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
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@889045 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca')
-rw-r--r-- | sca-java-2.x/trunk/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistry.java | 17 |
1 files changed, 11 insertions, 6 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 848d2e35cb..de01863b6a 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 @@ -78,7 +78,7 @@ public class ReplicatedEndpointRegistry implements EndpointRegistry, LifeCycleLi 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 @@ public class ReplicatedEndpointRegistry implements EndpointRegistry, LifeCycleLi } else { mcastService.setBind(getBindAddress()); } - + return channel; } @@ -179,26 +179,31 @@ public class ReplicatedEndpointRegistry implements EndpointRegistry, LifeCycleLi 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); |