Author: azeez Date: Tue Feb 28 14:54:23 2012 New Revision: 1294677 URL: http://svn.apache.org/viewvc?rev=1294677&view=rev Log: Auto localMemberPort increment was not working, if the specified port was not available. This commit fixes the bug.
Modified: axis/axis2/java/core/trunk/modules/clustering/src/org/apache/axis2/clustering/tribes/WkaBasedMembershipScheme.java Modified: axis/axis2/java/core/trunk/modules/clustering/src/org/apache/axis2/clustering/tribes/WkaBasedMembershipScheme.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/clustering/src/org/apache/axis2/clustering/tribes/WkaBasedMembershipScheme.java?rev=1294677&r1=1294676&r2=1294677&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/clustering/src/org/apache/axis2/clustering/tribes/WkaBasedMembershipScheme.java (original) +++ axis/axis2/java/core/trunk/modules/clustering/src/org/apache/axis2/clustering/tribes/WkaBasedMembershipScheme.java Tue Feb 28 14:54:23 2012 @@ -153,13 +153,13 @@ public class WkaBasedMembershipScheme im try { if (localPort != null) { port = Integer.parseInt(((String) localPort.getValue()).trim()); - port = getLocalPort(new ServerSocket(), localMember.getHostname(), port, 4000, 100); + port = getLocalPort(new ServerSocket(), localMember.getHostname(), port, 4000, 1000); } else { // In cases where the localport needs to be automatically figured out - port = getLocalPort(new ServerSocket(), localMember.getHostname(), -1, 4000, 100); + port = getLocalPort(new ServerSocket(), localMember.getHostname(), -1, 4000, 1000); } } catch (IOException e) { String msg = - "Could not allocate the specified port or a port in the range 4000-4100 " + + "Could not allocate the specified port or a port in the range 4000-5000 " + "for local host " + localMember.getHostname() + ". Check whether the IP address specified or inferred for the local " + "member is correct."; @@ -224,7 +224,7 @@ public class WkaBasedMembershipScheme im return true; } catch (IOException e) { String msg = e.getMessage(); - if (msg.indexOf("Connection refused") == -1 && msg.indexOf("connect timed out") == -1) { + if (!msg.contains("Connection refused") && !msg.contains("connect timed out")) { log.error("Cannot connect to member " + member.getHostName() + ":" + member.getPort(), e); } @@ -258,7 +258,7 @@ public class WkaBasedMembershipScheme im } catch (InterruptedException ignored) { ignored.printStackTrace(); } - getLocalPort(socket, hostname, portstart, retries, -1); + portstart = getLocalPort(socket, hostname, portstart, retries, -1); } } return portstart;