Author: azeez
Date: Sun Mar 13 21:41:45 2011
New Revision: 1081225

URL: http://svn.apache.org/viewvc?rev=1081225&view=rev
Log:
Do not replicate empty StateClusteringCommandCollections


Modified:
    
axis/axis2/java/core/trunk/modules/clustering/src/org/apache/axis2/clustering/state/DefaultStateManager.java
    
axis/axis2/java/core/trunk/modules/clustering/src/org/apache/axis2/clustering/state/commands/StateClusteringCommandCollection.java

Modified: 
axis/axis2/java/core/trunk/modules/clustering/src/org/apache/axis2/clustering/state/DefaultStateManager.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/clustering/src/org/apache/axis2/clustering/state/DefaultStateManager.java?rev=1081225&r1=1081224&r2=1081225&view=diff
==============================================================================
--- 
axis/axis2/java/core/trunk/modules/clustering/src/org/apache/axis2/clustering/state/DefaultStateManager.java
 (original)
+++ 
axis/axis2/java/core/trunk/modules/clustering/src/org/apache/axis2/clustering/state/DefaultStateManager.java
 Sun Mar 13 21:41:45 2011
@@ -76,8 +76,10 @@ public class DefaultStateManager impleme
     public void updateContexts(AbstractContext[] contexts) throws 
ClusteringFault {
         StateClusteringCommandCollection cmd =
                 StateClusteringCommandFactory.getCommandCollection(contexts,
-                                                                     
excludedReplicationPatterns);
-        sender.sendToGroup(cmd);
+                                                                   
excludedReplicationPatterns);
+        if (!cmd.isEmpty()) {
+            sender.sendToGroup(cmd);
+        }
     }
 
     public void replicateState(StateClusteringCommand command) throws 
ClusteringFault {

Modified: 
axis/axis2/java/core/trunk/modules/clustering/src/org/apache/axis2/clustering/state/commands/StateClusteringCommandCollection.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/clustering/src/org/apache/axis2/clustering/state/commands/StateClusteringCommandCollection.java?rev=1081225&r1=1081224&r2=1081225&view=diff
==============================================================================
--- 
axis/axis2/java/core/trunk/modules/clustering/src/org/apache/axis2/clustering/state/commands/StateClusteringCommandCollection.java
 (original)
+++ 
axis/axis2/java/core/trunk/modules/clustering/src/org/apache/axis2/clustering/state/commands/StateClusteringCommandCollection.java
 Sun Mar 13 21:41:45 2011
@@ -24,27 +24,29 @@ import org.apache.axis2.clustering.state
 import org.apache.axis2.context.ConfigurationContext;
 
 import java.util.ArrayList;
+import java.util.List;
 
 /**
- * 
+ *  A StateClusteringCommand consisting of a collection of other 
StateClusteringCommands
  */
 public class StateClusteringCommandCollection extends StateClusteringCommand {
 
-    private final ArrayList commands;
+    private final List<StateClusteringCommand> commands;
 
-    public StateClusteringCommandCollection(ArrayList commands) {
+    public StateClusteringCommandCollection(List<StateClusteringCommand> 
commands) {
         this.commands = commands;
     }
 
     public void execute(ConfigurationContext configContext) throws 
ClusteringFault {
-        for (int i = 0; i < commands.size(); i++) {
-            StateClusteringCommand cmd = (StateClusteringCommand) 
commands.get(i);
-            if (cmd != null) {
-                cmd.execute(configContext);
-            }
+        for (StateClusteringCommand command : commands) {
+            command.execute(configContext);
         }
     }
 
+    public boolean isEmpty(){
+        return commands != null && commands.isEmpty();
+    }
+
     public String toString() {
         return "StateClusteringCommandCollection";
     }


Reply via email to