axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From az...@apache.org
Subject svn commit: r668142 - in /webservices/axis2/trunk/java/modules: clustering/src/org/apache/axis2/clustering/ clustering/src/org/apache/axis2/clustering/tribes/ kernel/src/org/apache/axis2/clustering/
Date Mon, 16 Jun 2008 12:49:03 GMT
Author: azeez
Date: Mon Jun 16 05:49:02 2008
New Revision: 668142

URL: http://svn.apache.org/viewvc?rev=668142&view=rev
Log:
1. Handle scenario when HTTP and/or HTTPS transports are not available
2. Try to connect to HTTP/S ports only if they are available (!= -1)


Modified:
    webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/DefaultLoadBalanceEventHandler.java
    webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/LoadBalancerInterceptor.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/clustering/Member.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=668142&r1=668141&r2=668142&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
Mon Jun 16 05:49:02 2008
@@ -27,7 +27,7 @@
 import java.util.List;
 
 /**
- * The default, dummy implementation of {@link LoadBalanceEventHandler}
+ * The default implementation of {@link LoadBalanceEventHandler}
  */
 public class DefaultLoadBalanceEventHandler implements LoadBalanceEventHandler {
 
@@ -81,12 +81,16 @@
             for (int retries = 30; retries > 0; retries--) {
                 try {
                     InetAddress addr = InetAddress.getByName(member.getHostName());
-                    SocketAddress httpSockaddr = new InetSocketAddress(addr,
-                                                                       member.getHttpPort());
-                    new Socket().connect(httpSockaddr, 10000);
-                    SocketAddress httpsSockaddr = new InetSocketAddress(addr,
-                                                                        member.getHttpsPort());
-                    new Socket().connect(httpsSockaddr, 10000);
+                    int httpPort = member.getHttpPort();
+                    if (httpPort != -1) {
+                        SocketAddress httpSockaddr = new InetSocketAddress(addr, httpPort);
+                        new Socket().connect(httpSockaddr, 10000);
+                    }
+                    int httpsPort = member.getHttpsPort();
+                    if (httpsPort != -1) {
+                        SocketAddress httpsSockaddr = new InetSocketAddress(addr, httpsPort);
+                        new Socket().connect(httpsSockaddr, 10000);
+                    }
                     return true;
                 } catch (IOException e) {
                     String msg = e.getMessage();

Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/LoadBalancerInterceptor.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/LoadBalancerInterceptor.java?rev=668142&r1=668141&r2=668142&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/LoadBalancerInterceptor.java
(original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/LoadBalancerInterceptor.java
Mon Jun 16 05:49:02 2008
@@ -107,10 +107,17 @@
                 new org.apache.axis2.clustering.Member(TribesUtil.getHost(member),
                                                        member.getPort());
         Properties props = getProperties(member.getPayload());
-        int httpPort = Integer.parseInt(props.getProperty("HTTP"));
-        int httpsPort = Integer.parseInt(props.getProperty("HTTPS"));
-        axis2Member.setHttpPort(httpPort);
-        axis2Member.setHttpsPort(httpsPort);
+
+        String http = props.getProperty("HTTP");
+        if (http != null && http.trim().length() != 0) {
+            axis2Member.setHttpPort(Integer.parseInt(http));
+        }
+
+        String https = props.getProperty("HTTPS");
+        if (https != null && https.trim().length() != 0) {
+            axis2Member.setHttpsPort(Integer.parseInt(https));
+        }
+        
         return axis2Member;
     }
 

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/clustering/Member.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/clustering/Member.java?rev=668142&r1=668141&r2=668142&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/clustering/Member.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/clustering/Member.java
Mon Jun 16 05:49:02 2008
@@ -28,17 +28,17 @@
     /**
      * The TCP port used by this member for communicating clustering messages
      */
-    private int port;
+    private int port = -1;
 
     /**
      * The HTTP port used by this member for servicing Web service requests. Used for load
balancing
      */
-    private int httpPort;
+    private int httpPort = -1;
 
     /**
      * The HTTPS port used by this member for servicing Web service requests. Used for load
balancing
      */
-    private int httpsPort;
+    private int httpsPort = -1;
 
     public Member(String hostName, int port) {
         this.hostName = hostName;



Mime
View raw message