axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From az...@apache.org
Subject svn commit: r664678 - in /webservices/axis2/trunk/java/modules: clustering/src/org/apache/axis2/clustering/control/wka/ clustering/src/org/apache/axis2/clustering/tribes/ kernel/src/org/apache/axis2/clustering/
Date Mon, 09 Jun 2008 11:09:32 GMT
Author: azeez
Date: Mon Jun  9 04:09:32 2008
New Revision: 664678

URL: http://svn.apache.org/viewvc?rev=664678&view=rev
Log:
Set the HTTP/S ports as membership properties. So when a new member joins, we can automatically
detect its ports which can be used for load balancing



Modified:
    webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/control/wka/MemberListCommand.java
    webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/AtMostOnceInterceptor.java
    webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/ChannelListener.java
    webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/ChannelSender.java
    webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/LoadBalancerInterceptor.java
    webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/MembershipManager.java
    webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/RpcRequestHandler.java
    webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesClusterManager.java
    webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesConstants.java
    webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesMembershipListener.java
    webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesUtil.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/control/wka/MemberListCommand.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/control/wka/MemberListCommand.java?rev=664678&r1=664677&r2=664678&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/control/wka/MemberListCommand.java
(original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/control/wka/MemberListCommand.java
Mon Jun  9 04:09:32 2008
@@ -67,10 +67,10 @@
     }
 
     private void addMember(Member localMember, Member member) {
-        log.info("Trying to add member " + TribesUtil.getHost(member) + "...");
+        log.info("Trying to add member " + TribesUtil.getName(member) + "...");
         if (!(Arrays.equals(localMember.getHost(), member.getHost()) &&
               localMember.getPort() == member.getPort())) {
-            log.info("Added member " + TribesUtil.getHost(member));
+            log.info("Added member " + TribesUtil.getName(member));
             membershipManager.memberAdded(member);
             staticMembershipInterceptor.memberAdded(member);
         }

Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/AtMostOnceInterceptor.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/AtMostOnceInterceptor.java?rev=664678&r1=664677&r2=664678&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/AtMostOnceInterceptor.java
(original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/AtMostOnceInterceptor.java
Mon Jun  9 04:09:32 2008
@@ -55,7 +55,7 @@
                 receivedMessages.put(msg, System.currentTimeMillis());
                 super.messageReceived(msg);
             } else {  // If it is a duplicate message, discard it. i.e. dont call super.messageReceived
-                log.info("Duplicate message received from " + TribesUtil.getHost(msg.getAddress()));
+                log.info("Duplicate message received from " + TribesUtil.getName(msg.getAddress()));
             }
         }
     }

Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/ChannelListener.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/ChannelListener.java?rev=664678&r1=664677&r2=664678&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/ChannelListener.java
(original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/ChannelListener.java
Mon Jun  9 04:09:32 2008
@@ -116,11 +116,11 @@
                 getPropertyNonReplicable(ClusteringConstants.CLUSTER_INITIALIZED) == null)
{
             log.warn("Received message " + msg +
                      " before cluster initialization has been completed from " +
-                     TribesUtil.getHost(sender));
+                     TribesUtil.getName(sender));
             return;
         }
         if (log.isDebugEnabled()) {
-            log.debug("Received message " + msg + " from " + TribesUtil.getHost(sender));
+            log.debug("Received message " + msg + " from " + TribesUtil.getName(sender));
         }
 
         try {

Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/ChannelSender.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/ChannelSender.java?rev=664678&r1=664677&r2=664678&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/ChannelSender.java
(original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/ChannelSender.java
Mon Jun  9 04:09:32 2008
@@ -63,11 +63,11 @@
                     channel.send(members, toByteMessage(msg),
                                  Channel.SEND_OPTIONS_USE_ACK |
                                  Channel.SEND_OPTIONS_SYNCHRONIZED_ACK |
-                                 TribesClusterManager.MSG_ORDER_OPTION);
+                                 TribesConstants.MSG_ORDER_OPTION);
                 } else {
                     channel.send(members, toByteMessage(msg),
                                  Channel.SEND_OPTIONS_ASYNCHRONOUS |
-                                 TribesClusterManager.MSG_ORDER_OPTION);
+                                 TribesConstants.MSG_ORDER_OPTION);
                 }
                 if (log.isDebugEnabled()) {
                     log.debug("Sent " + msg + " to group");
@@ -82,7 +82,7 @@
                 ChannelException.FaultyMember[] faultyMembers = e.getFaultyMembers();
                 for (ChannelException.FaultyMember faultyMember : faultyMembers) {
                     Member member = faultyMember.getMember();
-                    log.error("Member " + TribesUtil.getHost(member) + " is faulty",
+                    log.error("Member " + TribesUtil.getName(member) + " is faulty",
                               faultyMember.getCause());
                 }
             } catch (Exception e) {
@@ -124,21 +124,21 @@
                 channel.send(new Member[]{member}, toByteMessage(cmd),
                              Channel.SEND_OPTIONS_USE_ACK | Channel.SEND_OPTIONS_SYNCHRONIZED_ACK);
                 if (log.isDebugEnabled()) {
-                    log.debug("Sent " + cmd + " to " + TribesUtil.getHost(member));
+                    log.debug("Sent " + cmd + " to " + TribesUtil.getName(member));
                 }
             }
         } catch (NotSerializableException e) {
-            String message = "Could not send command message to " + TribesUtil.getHost(member)
+
+            String message = "Could not send command message to " + TribesUtil.getName(member)
+
                              " since it is not serializable.";
             log.error(message, e);
             throw new ClusteringFault(message, e);
         } catch (ChannelException e) {
-            log.error("Could not send message to " + TribesUtil.getHost(member));
+            log.error("Could not send message to " + TribesUtil.getName(member));
             ChannelException.FaultyMember[] faultyMembers = e.getFaultyMembers();
-            log.error("Member " + TribesUtil.getHost(member) + " is faulty",
+            log.error("Member " + TribesUtil.getName(member) + " is faulty",
                       faultyMembers[0].getCause());
         } catch (Exception e) {
-            String message = "Could not send message to " + TribesUtil.getHost(member) +
+            String message = "Could not send message to " + TribesUtil.getName(member) +
                              ". Reason " + e.getMessage();
             log.warn(message, e);
         }

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=664678&r1=664677&r2=664678&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  9 04:09:32 2008
@@ -92,10 +92,19 @@
 
         // Is this an application domain member?
         if (Arrays.equals(applicationDomain, member.getDomain())) {
-            log.info("Application member " + TribesUtil.getHost(member) + " joined cluster");
+            log.info("Application member " + TribesUtil.getName(member) + " joined cluster");
             if(eventHandler != null){
                 org.apache.axis2.clustering.Member axis2Member =
-                        new org.apache.axis2.clustering.Member(member.getName(), member.getPort());
+                        new org.apache.axis2.clustering.Member(TribesUtil.getHost(member),
+                                                               member.getPort());
+                byte[] payload = member.getPayload();
+                String payloadStr = new String(payload);
+
+                String[] ports = payloadStr.split(";");
+                int httpPort = Integer.parseInt(ports[0].substring(ports[0].indexOf(":")
+ 1));
+                int httpsPort = Integer.parseInt(ports[1].substring(ports[1].indexOf(":")
+ 1));
+                axis2Member.setHttpPort(httpPort);
+                axis2Member.setHttpsPort(httpsPort);
                 eventHandler.applicationMemberAdded(axis2Member);
             }
             applicationMembers.add(member);
@@ -118,7 +127,7 @@
 
         // Is this an application domain member?
         if (Arrays.equals(applicationDomain, member.getDomain())) {
-            log.info("Application member " + TribesUtil.getHost(member) + " left cluster");
+            log.info("Application member " + TribesUtil.getName(member) + " left cluster");
             if(eventHandler != null){
                 org.apache.axis2.clustering.Member axis2Member =
                         new org.apache.axis2.clustering.Member(member.getName(), member.getPort());

Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/MembershipManager.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/MembershipManager.java?rev=664678&r1=664677&r2=664678&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/MembershipManager.java
(original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/MembershipManager.java
Mon Jun  9 04:09:32 2008
@@ -90,7 +90,7 @@
         if (!members.contains(member)) {
             if (rpcChannel != null && wkaMembers.contains(member)) { // if it is
a well-known member
 
-                log.info("A WKA member " + TribesUtil.getHost(member) +
+                log.info("A WKA member " + TribesUtil.getName(member) +
                          " just joined the group. Sending MEMBER_LIST message.");
                 // send the memeber list to it
                 MemberListCommand memListCmd;
@@ -101,7 +101,7 @@
                                     Channel.SEND_OPTIONS_ASYNCHRONOUS, 10000);
                 } catch (Exception e) {
                     String errMsg = "Could not send MEMBER_LIST to well-known member " +
-                                    TribesUtil.getHost(member);
+                                    TribesUtil.getName(member);
                     log.error(errMsg, e);
                     throw new RemoteProcessException(errMsg, e);
                 }

Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/RpcRequestHandler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/RpcRequestHandler.java?rev=664678&r1=664677&r2=664678&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/RpcRequestHandler.java
(original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/RpcRequestHandler.java
Mon Jun  9 04:09:32 2008
@@ -70,7 +70,7 @@
             }
             try {
                 log.info("Received " + msg + " initialization request message from " +
-                         TribesUtil.getHost(invoker));
+                         TribesUtil.getName(invoker));
                 GetStateCommand command = (GetStateCommand) msg;
                 command.execute(configurationContext);
                 GetStateResponseCommand getStateRespCmd = new GetStateResponseCommand();
@@ -90,7 +90,7 @@
             }
             try {
                 log.info("Received " + msg + " initialization request message from " +
-                         TribesUtil.getHost(invoker));
+                         TribesUtil.getName(invoker));
                 GetConfigurationCommand command = (GetConfigurationCommand) msg;
                 command.execute(configurationContext);
                 GetConfigurationResponseCommand
@@ -103,7 +103,7 @@
                 throw new RemoteProcessException(errMsg, e);
             }
         } else if (msg instanceof JoinGroupCommand) {
-            log.info("Received JOIN message from " + TribesUtil.getHost(invoker));
+            log.info("Received JOIN message from " + TribesUtil.getName(invoker));
             MemberListCommand memListCmd;
             try {
                 // Add the member
@@ -120,7 +120,7 @@
             }
             return memListCmd;
         } else if (msg instanceof MemberJoinedCommand) {
-            log.info("Received MEMBER_JOINED message from " + TribesUtil.getHost(invoker));
+            log.info("Received MEMBER_JOINED message from " + TribesUtil.getName(invoker));
             try {
                 MemberJoinedCommand command = (MemberJoinedCommand) msg;
                 command.setMembershipManager(membershipManager);
@@ -146,7 +146,7 @@
                 throw new RemoteProcessException(errMsg, e);
             }
         }
-        return null;                      
+        return null;
     }
 
     public void leftOver(Serializable msg, Member member) {

Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesClusterManager.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesClusterManager.java?rev=664678&r1=664677&r2=664678&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesClusterManager.java
(original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesClusterManager.java
Mon Jun  9 04:09:32 2008
@@ -24,8 +24,8 @@
 import org.apache.axis2.clustering.ClusterManager;
 import org.apache.axis2.clustering.ClusteringConstants;
 import org.apache.axis2.clustering.ClusteringFault;
-import org.apache.axis2.clustering.RequestBlockingHandler;
 import org.apache.axis2.clustering.LoadBalanceEventHandler;
+import org.apache.axis2.clustering.RequestBlockingHandler;
 import org.apache.axis2.clustering.configuration.ConfigurationManager;
 import org.apache.axis2.clustering.configuration.DefaultConfigurationManager;
 import org.apache.axis2.clustering.context.ClusteringContextListener;
@@ -41,6 +41,7 @@
 import org.apache.axis2.description.HandlerDescription;
 import org.apache.axis2.description.Parameter;
 import org.apache.axis2.description.PhaseRule;
+import org.apache.axis2.description.TransportInDescription;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.engine.DispatchPhase;
 import org.apache.axis2.engine.Phase;
@@ -81,7 +82,6 @@
  * The main ClusterManager class for the Tribes based clustering implementation
  */
 public class TribesClusterManager implements ClusterManager {
-    public static final int MSG_ORDER_OPTION = 512;
 
     private static final Log log = LogFactory.getLog(TribesClusterManager.class);
 
@@ -160,6 +160,8 @@
 
         channel.addChannelListener(channelListener);
 
+        setMemberTransportInfo();
+
         TribesMembershipListener membershipListener = new TribesMembershipListener(membershipManager);
         channel.addMembershipListener(membershipListener);
         try {
@@ -264,6 +266,26 @@
         log.info("Cluster initialization completed.");
     }
 
+    private void setMemberTransportInfo() {
+        String payload = "";
+        AxisConfiguration axisConfig = configurationContext.getAxisConfiguration();
+        TransportInDescription httpTransport = axisConfig.getTransportIn("http");
+        if (httpTransport != null) {
+            Parameter port = httpTransport.getParameter("port");
+            if (port != null) {
+                payload +="HTTP:" + Integer.parseInt((String) port.getValue()) + ";";
+            }
+        }
+        TransportInDescription httpsTransport = axisConfig.getTransportIn("https");
+        if (httpsTransport != null) {
+            Parameter port = httpsTransport.getParameter("port");
+            if (port != null) {
+                payload +="HTTPS:" + Integer.parseInt((String) port.getValue()) + ";";
+            }
+        }
+        channel.getMembershipService().setPayload(payload.getBytes());
+    }
+
     /**
      * Get the membership scheme applicable to this cluster
      *
@@ -527,9 +549,9 @@
                 membershipManager.addWellKnownMember(tribesMember);
                 if (canConnect(member)) {
                     membershipManager.memberAdded(tribesMember);
-                    log.info("Added static member " + TribesUtil.getHost(tribesMember));
+                    log.info("Added static member " + TribesUtil.getName(tribesMember));
                 } else {
-                    log.info("Could not connect to member " + TribesUtil.getHost(tribesMember));
+                    log.info("Could not connect to member " + TribesUtil.getName(tribesMember));
                 }
             }
         }
@@ -649,11 +671,11 @@
                     new LoadBalancerInterceptor(domain, applicationDomain);
             Parameter lbEvtHandlerParam =
                     getParameter(ClusteringConstants.Parameters.LOAD_BALANCE_EVENT_HANDLER);
-            if(lbEvtHandlerParam != null && lbEvtHandlerParam.getValue() != null){
-                String lbEvtHandlerClass = ((String)lbEvtHandlerParam.getValue()).trim();
+            if (lbEvtHandlerParam != null && lbEvtHandlerParam.getValue() != null)
{
+                String lbEvtHandlerClass = ((String) lbEvtHandlerParam.getValue()).trim();
                 try {
                     lbInterceptor.
-                        setEventHandler((LoadBalanceEventHandler)Class.forName(lbEvtHandlerClass).newInstance());
+                            setEventHandler((LoadBalanceEventHandler) Class.forName(lbEvtHandlerClass).newInstance());
                 } catch (Exception e) {
                     String msg = "Could not instantiate LoadBalanceEventHandler class " +
                                  lbEvtHandlerClass;
@@ -670,7 +692,7 @@
 
         // Add the OrderInterceptor to preserve sender ordering
         OrderInterceptor orderInterceptor = new OrderInterceptor();
-        orderInterceptor.setOptionFlag(MSG_ORDER_OPTION);
+        orderInterceptor.setOptionFlag(TribesConstants.MSG_ORDER_OPTION);
         channel.addInterceptor(orderInterceptor);
 
         if (membershipScheme.equals(ClusteringConstants.MembershipScheme.WKA_BASED)) {
@@ -780,7 +802,7 @@
             Member member = (numberOfTries == 0) ?
                             membershipManager.getLongestLivingMember() : // First try to
get from the longest member alive
                             membershipManager.getRandomMember(); // Else get from a random
member
-            String memberHost = TribesUtil.getHost(member);
+            String memberHost = TribesUtil.getName(member);
             log.info("Trying to send intialization request to " + memberHost);
             try {
                 if (!sentMembersList.contains(memberHost)) {

Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesConstants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesConstants.java?rev=664678&r1=664677&r2=664678&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesConstants.java
(original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesConstants.java
Mon Jun  9 04:09:32 2008
@@ -20,6 +20,9 @@
  */
 public final class TribesConstants {
 
+    // Message sending and receiving options
+    public static final int MSG_ORDER_OPTION = 512;
+
     public static final String LOCAL_MEMBER_HOST = "localMemberHost";
     public static final String LOCAL_MEMBER_PORT = "localMemberPort";
 
@@ -33,11 +36,4 @@
     public static final String BIND_ADDRESS = "bindAddress";
     public static final String TCP_LISTEN_PORT = "tcpListenPort";
     public static final String MAX_RETRIES = "maxRetries";
-
-    public final class MembershipMessages {
-        public static final int JOIN = 3;
-        public static final int LEAVE = 5;
-        public static final int NEW_MEMBER_JOINED = 7;
-        public static final int MEMBER_LIST = 11;
-    }
 }

Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesMembershipListener.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesMembershipListener.java?rev=664678&r1=664677&r2=664678&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesMembershipListener.java
(original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesMembershipListener.java
Mon Jun  9 04:09:32 2008
@@ -39,13 +39,13 @@
     public void memberAdded(Member member) {
 
         if (membershipManager.memberAdded(member)) {
-            log.info("New member " + TribesUtil.getHost(member) + " joined cluster.");
+            log.info("New member " + TribesUtil.getName(member) + " joined cluster.");
         }
        //        System.err.println("++++++ IS COORD="+TribesClusterManager.nbc.isCoordinator());
     }
 
     public void memberDisappeared(Member member) {
-        log.info("Member " + TribesUtil.getHost(member) + " left cluster");
+        log.info("Member " + TribesUtil.getName(member) + " left cluster");
         membershipManager.memberDisappeared(member);
 
 //        System.err.println("++++++ IS COORD="+TribesClusterManager.nbc.isCoordinator());

Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesUtil.java?rev=664678&r1=664677&r2=664678&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesUtil.java
(original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesUtil.java
Mon Jun  9 04:09:32 2008
@@ -35,7 +35,7 @@
             if (length > 0) {
                 log.info("Members of current cluster");
                 for (int i = 0; i < length; i++) {
-                    log.info("Member" + (i + 1) + " " + getHost(members[i]));
+                    log.info("Member" + (i + 1) + " " + getName(members[i]));
                 }
             } else {
                 log.info("No members in current cluster");
@@ -43,6 +43,10 @@
         }
     }
 
+    public static String getName(Member member) {
+        return getHost(member) + ":" + member.getPort();
+    }
+
     public static String getHost(Member member) {
         byte[] hostBytes = member.getHost();
         StringBuffer host = new StringBuffer();
@@ -55,10 +59,10 @@
                 }
             }
         }
-        return host.append(":").append(member.getPort()).toString();
+        return host.toString();
     }
 
     public static String getLocalHost(Channel channel) {
-        return getHost(channel.getLocalMember(true));
+        return getName(channel.getLocalMember(true));
     }
 }

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=664678&r1=664677&r2=664678&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  9 04:09:32 2008
@@ -26,10 +26,20 @@
     private String hostName;
 
     /**
-     * The TCP port used by this member
+     * The TCP port used by this member for communicating clustering messages
      */
     private int port;
 
+    /**
+     * The HTTP port used by this member for servicing Web service requests. Used for load
balancing
+     */
+    private int httpPort;
+
+    /**
+     * The HTTPS port used by this member for servicing Web service requests. Used for load
balancing
+     */
+    private int httpsPort;
+
     public Member(String hostName, int port) {
         this.hostName = hostName;
         this.port = port;
@@ -43,6 +53,22 @@
         return port;
     }
 
+    public int getHttpsPort() {
+        return httpsPort;
+    }
+
+    public void setHttpsPort(int httpsPort) {
+        this.httpsPort = httpsPort;
+    }
+
+    public int getHttpPort() {
+        return httpPort;
+    }
+
+    public void setHttpPort(int httpPort) {
+        this.httpPort = httpPort;
+    }
+
     public boolean equals(Object o) {
         if (this == o) {
             return true;



Mime
View raw message