axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From az...@apache.org
Subject svn commit: r707371 - /webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/DefaultLoadBalanceEventHandler.java
Date Thu, 23 Oct 2008 13:18:51 GMT
Author: azeez
Date: Thu Oct 23 06:18:51 2008
New Revision: 707371

URL: http://svn.apache.org/viewvc?rev=707371&view=rev
Log:
If the member does not already exist in the list, add it.

Modified:
    webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/DefaultLoadBalanceEventHandler.java

Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/DefaultLoadBalanceEventHandler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/DefaultLoadBalanceEventHandler.java?rev=707371&r1=707370&r2=707371&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/DefaultLoadBalanceEventHandler.java
(original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/DefaultLoadBalanceEventHandler.java
Thu Oct 23 06:18:51 2008
@@ -58,7 +58,7 @@
         }
 
         public void run() {
-            if(members.contains(member)){
+            if (members.contains(member)) {
                 return;
             }
             if (canConnect(member)) {
@@ -67,7 +67,9 @@
                 //                } catch (InterruptedException e) {
                 //                    e.printStackTrace();
                 //                }
-                members.add(member);
+                if (!members.contains(member)) {
+                    members.add(member);
+                }
                 log.info("Application member " + member + " joined application cluster");
             } else {
                 log.error("Could not add application member " + member);
@@ -81,14 +83,14 @@
          * @return true, if the member can be contacted; false, otherwise.
          */
         private boolean canConnect(Member member) {
-            if(log.isDebugEnabled()){
+            if (log.isDebugEnabled()) {
                 log.debug("Trying to connect to member " + member + "...");
             }
             for (int retries = 30; retries > 0; retries--) {
                 try {
                     InetAddress addr = InetAddress.getByName(member.getHostName());
                     int httpPort = member.getHttpPort();
-                    if(log.isDebugEnabled()){
+                    if (log.isDebugEnabled()) {
                         log.debug("HTTP Port=" + httpPort);
                     }
                     if (httpPort != -1) {
@@ -96,7 +98,7 @@
                         new Socket().connect(httpSockaddr, 10000);
                     }
                     int httpsPort = member.getHttpsPort();
-                    if(log.isDebugEnabled()){
+                    if (log.isDebugEnabled()) {
                         log.debug("HTTPS Port=" + httpsPort);
                     }
                     if (httpsPort != -1) {
@@ -105,7 +107,7 @@
                     }
                     return true;
                 } catch (IOException e) {
-                    if(log.isDebugEnabled()){
+                    if (log.isDebugEnabled()) {
                         log.debug("", e);
                     }
                     String msg = e.getMessage();



Mime
View raw message