[jbosscache-commits] JBoss Cache SVN: r5558 - in core/trunk/src/main/java/org/jboss/cache: commands/remote and 2 other directories.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Mon Apr 14 11:08:16 EDT 2008


Author: mircea.markus
Date: 2008-04-14 11:08:16 -0400 (Mon, 14 Apr 2008)
New Revision: 5558

Modified:
   core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveNodeCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/invocation/CacheData.java
   core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
Log:
JBCACHE-1222 - fixed API tests

Modified: core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveNodeCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveNodeCommand.java	2008-04-14 14:54:45 UTC (rev 5557)
+++ core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveNodeCommand.java	2008-04-14 15:08:16 UTC (rev 5558)
@@ -244,4 +244,9 @@
       skipSendingNodeEvents = (Boolean) args[3];
       if (commandId == VERSIONED_METHOD_ID) dataVersion = (DataVersion) args[4];
    }
+
+   public void setSkipSendingNodeEvents(boolean skipSendingNodeEvents)
+   {
+      this.skipSendingNodeEvents = skipSendingNodeEvents;
+   }
 }

Modified: core/trunk/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java	2008-04-14 14:54:45 UTC (rev 5557)
+++ core/trunk/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java	2008-04-14 15:08:16 UTC (rev 5558)
@@ -20,6 +20,7 @@
 import org.jboss.cache.transaction.GlobalTransaction;
 
 import java.util.Set;
+import java.util.List;
 
 /**
  * Data gravitation cleanup handler.
@@ -132,7 +133,7 @@
 
    private void evictNode(Fqn fqn) throws Throwable
    {
-      Set<Fqn> toEvict = cacheData.getNodesForEviction(fqn, true);
+      List<Fqn> toEvict = cacheData.getNodesForEviction(fqn, true);
       for (Fqn aFqn : toEvict)
       {
          EvictNodeCommand evictFqnCommand = new EvictNodeCommand(aFqn);

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java	2008-04-14 14:54:45 UTC (rev 5557)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java	2008-04-14 15:08:16 UTC (rev 5558)
@@ -241,10 +241,9 @@
       if (!createdNodes.isEmpty())
       {
          if (trace) log.trace("There were new nodes created, skipping notification on delete");
-         Object[] args = ctx.getMethodCall().getArgs();
          if (trace)
-            log.trace("Changing 'skipNotification' for method '_remove' from " + args[args.length - 1] + " to true");
-         args[args.length - 1] = Boolean.TRUE;
+            log.trace("Changing 'skipNotification' for command 'remove' from " + command.isSkipSendingNodeEvents() + " to true");
+         command.setSkipSendingNodeEvents(true);
       }
 
       Object retVal = invokeNextInterceptor(ctx, command);

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java	2008-04-14 14:54:45 UTC (rev 5557)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java	2008-04-14 15:08:16 UTC (rev 5558)
@@ -77,10 +77,10 @@
    @Inject
    public void intialize(Configuration configuration,  RPCManager rpcManager,
                          CacheTransactionHelper transactionHelper, Notifier notifier, InvocationContextContainer icc,
-                         CacheLifecycleManager lifecycleManager) 
+                         CacheLifecycleManager lifecycleManager, CommandsFactory factory)
    {
       this.configuration = configuration;
-      this.commandsFactory = commandsFactory;
+      this.commandsFactory = factory;
       this.rpcManager = rpcManager;
       this.transactionHelper = transactionHelper;
       this.notifier = notifier;

Modified: core/trunk/src/main/java/org/jboss/cache/invocation/CacheData.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/invocation/CacheData.java	2008-04-14 14:54:45 UTC (rev 5557)
+++ core/trunk/src/main/java/org/jboss/cache/invocation/CacheData.java	2008-04-14 15:08:16 UTC (rev 5558)
@@ -188,9 +188,9 @@
       return root;
    }
 
-   public Set<Fqn> getNodesForEviction(Fqn parent, boolean recursive)
+   public List<Fqn> getNodesForEviction(Fqn parent, boolean recursive)
    {
-      Set<Fqn> result = new HashSet<Fqn>();
+      List<Fqn> result = new ArrayList<Fqn>();
       NodeSPI node = peek(parent, false);
       if (recursive)
       {
@@ -203,7 +203,7 @@
       return result;
    }
 
-   private void recursiveAddEvictionNodes(NodeSPI node, Set<Fqn> result)
+   private void recursiveAddEvictionNodes(NodeSPI node, List<Fqn> result)
    {
       for (NodeSPI child : (Set<NodeSPI>) node.getChildrenDirect())
       {
@@ -212,7 +212,7 @@
       buildNodesForEviction(node, result);
    }
 
-   private void buildNodesForEviction(Node node, Set<Fqn> nodes)
+   private void buildNodesForEviction(Node node, List<Fqn> nodes)
    {
       if (node != null && node.isResident())
       {
@@ -441,7 +441,7 @@
 
    public void evict(Fqn fqn, boolean recursive)
    {
-      Set<Fqn> toEvict = getNodesForEviction(fqn, recursive);
+      List<Fqn> toEvict = getNodesForEviction(fqn, recursive);
       for (Fqn aFqn : toEvict)
       {
          evict(aFqn);
@@ -472,6 +472,7 @@
       NodeSPI parentNode = targetNode.getParent();
       if (parentNode != null)
       {
+         parentNode.removeChildDirect(fqn.getLastElement());
          parentNode.setChildrenLoaded(false);
       }
    }

Modified: core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java	2008-04-14 14:54:45 UTC (rev 5557)
+++ core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java	2008-04-14 15:08:16 UTC (rev 5558)
@@ -354,7 +354,7 @@
    public void evict(Fqn<?> fqn, boolean recursive)
    {
       if (!getCacheStatus().allowInvocations()) throw new IllegalStateException("Cache is not in STARTED state");
-      Set<Fqn> nodesToEvict = cacheData.getNodesForEviction(fqn, recursive);
+      List<Fqn> nodesToEvict = cacheData.getNodesForEviction(fqn, recursive);
       for (Fqn aFqn : nodesToEvict)
       {
          invoke(commandsFactory.buildEvictFqnCommand(aFqn));




More information about the jbosscache-commits mailing list