[jbosscache-commits] JBoss Cache SVN: r5784 - in core/trunk/src/main/java/org/jboss/cache: factories and 1 other directories.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Thu May 1 04:59:38 EDT 2008


Author: manik.surtani at jboss.com
Date: 2008-05-01 04:59:38 -0400 (Thu, 01 May 2008)
New Revision: 5784

Modified:
   core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyManager.java
   core/trunk/src/main/java/org/jboss/cache/factories/CommandsFactory.java
   core/trunk/src/main/java/org/jboss/cache/marshall/CommandAwareRpcDispatcher.java
Log:
Fixed failures

Modified: core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyManager.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyManager.java	2008-04-30 17:15:24 UTC (rev 5783)
+++ core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyManager.java	2008-05-01 08:59:38 UTC (rev 5784)
@@ -991,7 +991,7 @@
          }
       }
 
-      rpcManager.callRemoteMethods(new Vector<Address>(recipients), call, true, config.getBuddyCommunicationTimeout(), false);
+      rpcManager.callRemoteMethods(recipients == null ? null : new Vector<Address>(recipients), call, true, config.getBuddyCommunicationTimeout(), false);
    }
 
 

Modified: core/trunk/src/main/java/org/jboss/cache/factories/CommandsFactory.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/factories/CommandsFactory.java	2008-04-30 17:15:24 UTC (rev 5783)
+++ core/trunk/src/main/java/org/jboss/cache/factories/CommandsFactory.java	2008-05-01 08:59:38 UTC (rev 5784)
@@ -1,18 +1,41 @@
 package org.jboss.cache.factories;
 
-import org.jboss.cache.*;
+import org.jboss.cache.CacheException;
+import org.jboss.cache.CacheSPI;
+import org.jboss.cache.DataContainer;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.RPCManager;
 import org.jboss.cache.buddyreplication.BuddyGroup;
 import org.jboss.cache.buddyreplication.BuddyManager;
 import org.jboss.cache.commands.DataCommand;
 import org.jboss.cache.commands.ReplicableCommand;
 import org.jboss.cache.commands.ReversibleCommand;
-import org.jboss.cache.commands.read.*;
-import org.jboss.cache.commands.remote.*;
+import org.jboss.cache.commands.read.ExistsCommand;
+import org.jboss.cache.commands.read.GetChildrenNamesCommand;
+import org.jboss.cache.commands.read.GetDataMapCommand;
+import org.jboss.cache.commands.read.GetKeyValueCommand;
+import org.jboss.cache.commands.read.GetKeysCommand;
+import org.jboss.cache.commands.read.GetNodeCommand;
+import org.jboss.cache.commands.read.GravitateDataCommand;
+import org.jboss.cache.commands.remote.AnnounceBuddyPoolNameCommand;
+import org.jboss.cache.commands.remote.AssignToBuddyGroupCommand;
+import org.jboss.cache.commands.remote.ClusteredGetCommand;
+import org.jboss.cache.commands.remote.DataGravitationCleanupCommand;
+import org.jboss.cache.commands.remote.RemoveFromBuddyGroupCommand;
+import org.jboss.cache.commands.remote.ReplicateCommand;
 import org.jboss.cache.commands.tx.CommitCommand;
 import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
 import org.jboss.cache.commands.tx.PrepareCommand;
 import org.jboss.cache.commands.tx.RollbackCommand;
-import org.jboss.cache.commands.write.*;
+import org.jboss.cache.commands.write.CreateNodeCommand;
+import org.jboss.cache.commands.write.EvictCommand;
+import org.jboss.cache.commands.write.InvalidateCommand;
+import org.jboss.cache.commands.write.MoveCommand;
+import org.jboss.cache.commands.write.PutDataMapCommand;
+import org.jboss.cache.commands.write.PutKeyValueCommand;
+import org.jboss.cache.commands.write.RemoveDataCommand;
+import org.jboss.cache.commands.write.RemoveKeyCommand;
+import org.jboss.cache.commands.write.RemoveNodeCommand;
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.factories.annotations.Inject;
 import org.jboss.cache.interceptors.InterceptorChain;
@@ -280,56 +303,57 @@
     */
    public ReplicableCommand fromStream(int id, Object[] parameters)
    {
+      ReplicableCommand command;
       switch (id)
       {
          case ExistsCommand.METHOD_ID:
          {
             ExistsCommand result = new ExistsCommand();
             result.initialize(dataContainer);
-            result.setParameters(id, parameters);
-            return result;
+            command = result;
+            break;
          }
          case GetChildrenNamesCommand.METHOD_ID:
          {
             GetChildrenNamesCommand returnValue = new GetChildrenNamesCommand();
             returnValue.initialize(dataContainer);
-            returnValue.setParameters(id, parameters);
-            return returnValue;
+            command = returnValue;
+            break;
          }
          case GetDataMapCommand.METHOD_ID:
          {
             GetDataMapCommand returnValue = new GetDataMapCommand();
             returnValue.initialize(dataContainer);
-            returnValue.setParameters(id, parameters);
-            return returnValue;
+            command = returnValue;
+            break;
          }
          case GetKeysCommand.METHOD_ID:
          {
             GetKeysCommand returnValue = new GetKeysCommand();
             returnValue.initialize(dataContainer);
-            returnValue.setParameters(id, parameters);
-            return returnValue;
+            command = returnValue;
+            break;
          }
          case GetKeyValueCommand.METHOD_ID:
          {
             GetKeyValueCommand returnValue = new GetKeyValueCommand();
             returnValue.initialize(dataContainer, notifier);
-            returnValue.setParameters(id, parameters);
-            return returnValue;
+            command = returnValue;
+            break;
          }
          case GetNodeCommand.METHOD_ID:
          {
             GetNodeCommand returnValue = new GetNodeCommand();
             returnValue.initialize(dataContainer);
-            returnValue.setParameters(id, parameters);
-            return returnValue;
+            command = returnValue;
+            break;
          }
          case MoveCommand.METHOD_ID:
          {
             MoveCommand returnValue = new MoveCommand();
             returnValue.initialize(notifier, dataContainer);
-            returnValue.setParameters(id, parameters);
-            return returnValue;
+            command = returnValue;
+            break;
          }
          case PutDataMapCommand.METHOD_ID:
          case PutDataMapCommand.ERASE_METHOD_ID:
@@ -337,9 +361,9 @@
          case PutDataMapCommand.VERSIONED_METHOD_ID:
          {
             PutDataMapCommand returnValue = new PutDataMapCommand();
-            returnValue.initialize(notifier,dataContainer);
-            returnValue.setParameters(id, parameters);
-            return returnValue;
+            returnValue.initialize(notifier, dataContainer);
+            command = returnValue;
+            break;
          }
          case PutKeyValueCommand.METHOD_ID:
          case PutKeyValueCommand.VERSIONED_METHOD_ID:
@@ -348,24 +372,24 @@
          {
             PutKeyValueCommand returnValue = new PutKeyValueCommand();
             returnValue.initialize(notifier, dataContainer);
-            returnValue.setParameters(id, parameters);
-            return returnValue;
+            command = returnValue;
+            break;
          }
          case RemoveDataCommand.METHOD_ID:
          case RemoveDataCommand.VERSIONED_METHOD_ID:
          {
             RemoveDataCommand returnValue = new RemoveDataCommand();
             returnValue.initialize(notifier, dataContainer);
-            returnValue.setParameters(id, parameters);
-            return returnValue;
+            command = returnValue;
+            break;
          }
          case RemoveKeyCommand.METHOD_ID:
          case RemoveKeyCommand.VERSIONED_METHOD_ID:
          {
             RemoveKeyCommand returnValue = new RemoveKeyCommand();
             returnValue.initialize(notifier, dataContainer);
-            returnValue.setParameters(id, parameters);
-            return returnValue;            
+            command = returnValue;
+            break;
          }
 
          case RemoveNodeCommand.METHOD_ID:
@@ -373,54 +397,50 @@
          {
             RemoveNodeCommand returnValue = new RemoveNodeCommand();
             returnValue.initialize(notifier, dataContainer);
-            returnValue.setParameters(id, parameters);
-            return returnValue;
+            command = returnValue;
+            break;
          }
          case CreateNodeCommand.METHOD_ID:
          {
             CreateNodeCommand returnValue = new CreateNodeCommand();
             returnValue.initialize(dataContainer);
-            returnValue.setParameters(id, parameters);
-            return returnValue;
+            command = returnValue;
+            break;
          }
          // --- transactional method calls
 
          case PrepareCommand.METHOD_ID:
          {
-            PrepareCommand returnValue = new PrepareCommand();
-            returnValue.setParameters(id, parameters);
-            return returnValue;            
+            command = new PrepareCommand();
+            break;
          }
 
          case OptimisticPrepareCommand.METHOD_ID:
          {
-            OptimisticPrepareCommand returnValue = new OptimisticPrepareCommand();
-            returnValue.setParameters(id, parameters);
-            return returnValue;
+            command = new OptimisticPrepareCommand();
+            break;
          }
 
          case CommitCommand.METHOD_ID:
          {
-            CommitCommand returnValue = new CommitCommand();
-            returnValue.setParameters(id, parameters);
-            return returnValue;
+            command = new CommitCommand();
+            break;
          }
 
          case RollbackCommand.METHOD_ID:
          {
-            RollbackCommand returnValue = new RollbackCommand();
-            returnValue.setParameters(id, parameters);
-            return returnValue;
+            command = new RollbackCommand();
+            break;
          }
 
-            // --- replicate methods
+         // --- replicate methods
          case ReplicateCommand.MULTIPLE_METHOD_ID:
          case ReplicateCommand.SINGLE_METHOD_ID:
          {
             ReplicateCommand returnValue = new ReplicateCommand();
             returnValue.initialize(invoker);
-            returnValue.setParameters(id, parameters);
-            return returnValue;
+            command = returnValue;
+            break;
          }
 
          case InvalidateCommand.METHOD_ID:
@@ -428,55 +448,58 @@
             InvalidateCommand returnValue = new InvalidateCommand();
             returnValue.initialize(txManager, cacheSpi, configuration.isNodeLockingOptimistic());
             returnValue.initialize(notifier, dataContainer);
-            returnValue.setParameters(id, parameters);
-            return returnValue;
+            command = returnValue;
+            break;
          }
 
          case ClusteredGetCommand.METHOD_ID:
          {
             ClusteredGetCommand returnValue = new ClusteredGetCommand();
             returnValue.initialize(dataContainer, invoker);
-            returnValue.setParameters(id, parameters);
-            return returnValue;
+            command = returnValue;
+            break;
          }
-            // ---- Buddy replication - group organisation commands
+         // ---- Buddy replication - group organisation commands
          case AnnounceBuddyPoolNameCommand.METHOD_ID:
          {
             AnnounceBuddyPoolNameCommand returnValue = new AnnounceBuddyPoolNameCommand();
             returnValue.initialize(buddyManager);
-            returnValue.setParameters(id, parameters);
-            return returnValue;
+            command = returnValue;
+            break;
          }
          case AssignToBuddyGroupCommand.METHOD_ID:
          {
             AssignToBuddyGroupCommand returnValue = new AssignToBuddyGroupCommand();
             returnValue.initialize(buddyManager);
-            returnValue.setParameters(id, parameters);
-            return returnValue;
+            command = returnValue;
+            break;
          }
          case RemoveFromBuddyGroupCommand.METHOD_ID:
          {
             RemoveFromBuddyGroupCommand returnValue = new RemoveFromBuddyGroupCommand();
             returnValue.initialize(buddyManager);
-            returnValue.setParameters(id, parameters);
-            return returnValue;
+            command = returnValue;
+            break;
          }
          case DataGravitationCleanupCommand.METHOD_ID:
          {
             DataGravitationCleanupCommand returnValue = new DataGravitationCleanupCommand();
             returnValue.initialize(buddyManager, invoker, transactionTable, this, dataContainer);
-            returnValue.setParameters(id, parameters);
-            return returnValue;
+            command = returnValue;
+            break;
          }
          case GravitateDataCommand.METHOD_ID:
          {
             GravitateDataCommand returnValue = new GravitateDataCommand();
-            returnValue.initialize(dataContainer);
-            returnValue.setParameters(id, parameters);
-            return returnValue;
+            returnValue.initialize(dataContainer, rpcManager, cacheSpi);
+            command = returnValue;
+            break;
          }
          default:
             throw new CacheException("Unknown command id " + id + "!");
       }
+
+      command.setParameters(id, parameters);
+      return command;
    }
 }

Modified: core/trunk/src/main/java/org/jboss/cache/marshall/CommandAwareRpcDispatcher.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/marshall/CommandAwareRpcDispatcher.java	2008-04-30 17:15:24 UTC (rev 5783)
+++ core/trunk/src/main/java/org/jboss/cache/marshall/CommandAwareRpcDispatcher.java	2008-05-01 08:59:38 UTC (rev 5784)
@@ -115,7 +115,7 @@
    {
       for (Rsp r : l.values())
       {
-         if (r.getValue() != null) return false;
+         if (r.getValue() != null || !r.wasReceived() || r.wasSuspected()) return false;
       }
       return true;
    }




More information about the jbosscache-commits mailing list