axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From az...@apache.org
Subject svn commit: r543446 - in /webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering: context/ContextClusteringCommandFactory.java tribes/AckManager.java tribes/TribesUtil.java
Date Fri, 01 Jun 2007 09:36:06 GMT
Author: azeez
Date: Fri Jun  1 02:36:04 2007
New Revision: 543446

URL: http://svn.apache.org/viewvc?view=rev&rev=543446
Log:
Handle scenario where there is only one single node in the cluster


Modified:
    webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/ContextClusteringCommandFactory.java
    webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/AckManager.java
    webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesUtil.java

Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/ContextClusteringCommandFactory.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/ContextClusteringCommandFactory.java?view=diff&rev=543446&r1=543445&r2=543446
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/ContextClusteringCommandFactory.java
(original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/ContextClusteringCommandFactory.java
Fri Jun  1 02:36:04 2007
@@ -123,31 +123,35 @@
                                        boolean includeAllProperties) {
         if (!includeAllProperties) {
             Map diffs = context.getPropertyDifferences();
-            for (Iterator iter = diffs.keySet().iterator(); iter.hasNext();) {
-                String key = (String) iter.next();
-                Object prop = context.getPropertyNonReplicable(key);
-                if (prop instanceof Serializable) { // First check whether it is serializable
+            synchronized (context) {
+                for (Iterator iter = diffs.keySet().iterator(); iter.hasNext();) {
+                    String key = (String) iter.next();
+                    Object prop = context.getPropertyNonReplicable(key);
+                    if (prop instanceof Serializable) { // First check whether it is serializable
 
-                    // Next check whether it matches an excluded pattern
-                    if (!isExcluded(key, context.getClass().getName(), excludedPropertyPatterns))
{
-                        log.debug("sending property =" + key + "-" + prop);
-                        PropertyDifference diff = (PropertyDifference) diffs.get(key);
-                        diff.setValue(prop);
-                        updateCmd.addProperty(diff);
+                        // Next check whether it matches an excluded pattern
+                        if (!isExcluded(key, context.getClass().getName(), excludedPropertyPatterns))
{
+                            log.debug("sending property =" + key + "-" + prop);
+                            PropertyDifference diff = (PropertyDifference) diffs.get(key);
+                            diff.setValue(prop);
+                            updateCmd.addProperty(diff);
+                        }
                     }
                 }
             }
         } else {
-            for (Iterator iter = context.getPropertyNames(); iter.hasNext();) {
-                String key = (String) iter.next();
-                Object prop = context.getPropertyNonReplicable(key);
-                if (prop instanceof Serializable) { // First check whether it is serializable
+            synchronized (context) {
+                for (Iterator iter = context.getPropertyNames(); iter.hasNext();) {
+                    String key = (String) iter.next();
+                    Object prop = context.getPropertyNonReplicable(key);
+                    if (prop instanceof Serializable) { // First check whether it is serializable
 
-                    // Next check whether it matches an excluded pattern
-                    if (!isExcluded(key, context.getClass().getName(), excludedPropertyPatterns))
{
-                        log.debug("sending property =" + key + "-" + prop);
-                        PropertyDifference diff = new PropertyDifference(key, prop, false);
-                        updateCmd.addProperty(diff);
+                        // Next check whether it matches an excluded pattern
+                        if (!isExcluded(key, context.getClass().getName(), excludedPropertyPatterns))
{
+                            log.debug("sending property =" + key + "-" + prop);
+                            PropertyDifference diff = new PropertyDifference(key, prop, false);
+                            updateCmd.addProperty(diff);
+                        }
                     }
                 }
             }

Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/AckManager.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/AckManager.java?view=diff&rev=543446&r1=543445&r2=543446
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/AckManager.java
(original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/AckManager.java
Fri Jun  1 02:36:04 2007
@@ -37,7 +37,6 @@
 
     public static void addAcknowledgement(String messageUniqueId,
                                           String memberId) {
-        System.err.println("######### Added ACK for msg " + messageUniqueId + " from member
" + memberId);
         MessageACK ack = (MessageACK) messageAckTable.get(messageUniqueId);
         if (ack != null) {
             List memberList = ack.getMemberList();
@@ -47,7 +46,6 @@
 
     public static boolean isMessageAcknowledged(String messageUniqueId,
                                                 ChannelSender sender) throws ClusteringFault
{
-        System.err.println("########## Call to isMessageAcknowledged for msg UUID " + messageUniqueId);
         boolean isAcknowledged = false;
         MessageACK ack = (MessageACK) messageAckTable.get(messageUniqueId);
         List memberList = ack.getMemberList();
@@ -55,17 +53,21 @@
         // Check that all members in the memberList are same as the total member list,
         // which will indicate that all members have ACKed the message
         Member[] members = sender.getChannel().getMembers();
-        for (int i = 0; i < members.length; i++) {
-            Member member = members[i];
-            if (!memberList.contains(member.getName())) {
+        if (members.length == 0) {
+            isAcknowledged = true;
+        } else {
+            for (int i = 0; i < members.length; i++) {
+                Member member = members[i];
+                if (!memberList.contains(member.getName())) {
 
-                // At this point, resend the original message back to the node which has
not
-                // sent an ACK
-                sender.sendToMember(ack.getCommand(), member);
-                isAcknowledged = false;
-                break;
-            } else {
-                isAcknowledged = true;
+                    // At this point, resend the original message back to the node which
has not
+                    // sent an ACK
+                    sender.sendToMember(ack.getCommand(), member);
+                    isAcknowledged = false;
+                    break;
+                } else {
+                    isAcknowledged = true;
+                }
             }
         }
 

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?view=diff&rev=543446&r1=543445&r2=543446
==============================================================================
--- 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
Fri Jun  1 02:36:04 2007
@@ -39,7 +39,7 @@
                             host = host == null ? ("" + hostBts[j]) : (host + "." + hostBts[j]);
                         }
                     }
-                    log.info("Member " + (i + 1) + " " + members[i].getName());
+                    log.info("Member" + (i + 1) + " " + members[i].getName());
                 }
             } else {
                 log.info("No members in current cluster");



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message