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

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Wed Jan 30 13:24:23 EST 2008


Author: mircea.markus
Date: 2008-01-30 13:24:23 -0500 (Wed, 30 Jan 2008)
New Revision: 5265

Modified:
   core/trunk/src/main/java/org/jboss/cache/CacheImpl.java
   core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
   core/trunk/src/main/java/org/jboss/cache/marshall/MethodDeclarations.java
Log:
removal event is not triggered anymore when a phantom node is created

Modified: core/trunk/src/main/java/org/jboss/cache/CacheImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/CacheImpl.java	2008-01-30 17:38:21 UTC (rev 5264)
+++ core/trunk/src/main/java/org/jboss/cache/CacheImpl.java	2008-01-30 18:24:23 UTC (rev 5265)
@@ -633,13 +633,13 @@
             _remove(null, // no tx
                   tmp,
                   false, // no undo ops
-                  false, // no nodeEvent
+                  true, // no nodeEvent
                   true);// is an eviction
          }
       }
 
       // Remove the root node of the subtree
-      _remove(null, subtree, false, false, true);
+      _remove(null, subtree, false, true, true);
 
    }
 
@@ -1210,13 +1210,13 @@
     * @param tx
     * @param fqn
     * @param create_undo_ops
-    * @param sendNodeEvent
+    * @param skipSendingNodeEvents
     * @param eviction
     * @param version
     * @return true if the node was removed, false if not found
     * @throws CacheException
     */
-   public boolean _remove(GlobalTransaction tx, Fqn fqn, boolean create_undo_ops, boolean sendNodeEvent, boolean eviction, DataVersion version)
+   public boolean _remove(GlobalTransaction tx, Fqn fqn, boolean create_undo_ops, boolean skipSendingNodeEvents, boolean eviction, DataVersion version)
          throws CacheException
    {
 
@@ -1259,7 +1259,7 @@
          return false;
       }
 
-      if (!isRollback)
+      if (!isRollback && !skipSendingNodeEvents)
       {
          if (eviction)
          {
@@ -1304,7 +1304,7 @@
          transactionTable.addUndoOperation(tx, undo_op);
       }
 
-      if (!isRollback)
+      if (!isRollback && !skipSendingNodeEvents)
       {
          if (eviction)
          {
@@ -1559,7 +1559,7 @@
       }
       else
       {
-         _remove(null, fqn, false, false, true, version);
+         _remove(null, fqn, false, true, true, version);
          return true;
       }
    }
@@ -1669,7 +1669,7 @@
       if (gtx != null && undoOps)
       {
          // 1. put undo-op in TX' undo-operations list (needed to rollback TX)
-         transactionTable.addUndoOperation(gtx, MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal_id, gtx, fqn, false));
+         transactionTable.addUndoOperation(gtx, MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal_id, gtx, fqn, false, false));
       }
 
       if (!isRollback) notifier.notifyNodeCreated(fqn, false, ctx);

Modified: core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java	2008-01-30 17:38:21 UTC (rev 5264)
+++ core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java	2008-01-30 18:24:23 UTC (rev 5265)
@@ -274,7 +274,7 @@
                if (gtx != null)
                {
                   MethodCall undo_op = MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal_id,
-                        gtx, child_fqn, false);
+                        gtx, child_fqn, false, false);
                   cacheImpl.addUndoOperation(gtx, undo_op);
                   // add the node name to the list maintained for the current tx
                   // (needed for abort/rollback of transaction)

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java	2008-01-30 17:38:21 UTC (rev 5264)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java	2008-01-30 18:24:23 UTC (rev 5265)
@@ -246,8 +246,15 @@
          }
       }
       acquireLocksOnChildren(peekNode(ctx, fqn, false, false, false), NodeLock.LockType.WRITE, ctx);
+      if (!createdNodes.isEmpty())
+      {
+         if (trace) log.trace("There were new nodes created, skiping 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;         
+      }
+      
       Object retVal = nextInterceptor(ctx);
-
       // and make sure we remove all nodes we've created for the sake of later removal.
       if (ctx.getGlobalTransaction() == null)
       {

Modified: core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java	2008-01-30 17:38:21 UTC (rev 5264)
+++ core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java	2008-01-30 18:24:23 UTC (rev 5265)
@@ -422,7 +422,7 @@
       }
       else
       {
-         MethodCall m = MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal_id, tx, fqn, true);
+         MethodCall m = MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal_id, tx, fqn, true, false);
          Object retval = invoke(m);
          return retval != null && (Boolean) retval;
       }

Modified: core/trunk/src/main/java/org/jboss/cache/marshall/MethodDeclarations.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/marshall/MethodDeclarations.java	2008-01-30 17:38:21 UTC (rev 5264)
+++ core/trunk/src/main/java/org/jboss/cache/marshall/MethodDeclarations.java	2008-01-30 18:24:23 UTC (rev 5265)
@@ -245,7 +245,7 @@
          putDataEraseMethodLocal = CacheImpl.class.getDeclaredMethod("_put", GlobalTransaction.class, Fqn.class, Map.class, boolean.class, boolean.class);
          putKeyValMethodLocal = CacheImpl.class.getDeclaredMethod("_put", GlobalTransaction.class, Fqn.class, Object.class, Object.class, boolean.class);
          putForExternalReadMethodLocal = CacheImpl.class.getDeclaredMethod("_putForExternalRead", GlobalTransaction.class, Fqn.class, Object.class, Object.class);
-         removeNodeMethodLocal = CacheImpl.class.getDeclaredMethod("_remove", GlobalTransaction.class, Fqn.class, boolean.class);
+         removeNodeMethodLocal = CacheImpl.class.getDeclaredMethod("_remove", GlobalTransaction.class, Fqn.class, boolean.class, boolean.class);
          removeKeyMethodLocal = CacheImpl.class.getDeclaredMethod("_remove", GlobalTransaction.class, Fqn.class, Object.class, boolean.class);
          removeDataMethodLocal = CacheImpl.class.getDeclaredMethod("_removeData", GlobalTransaction.class, Fqn.class, boolean.class);
          evictNodeMethodLocal = CacheImpl.class.getDeclaredMethod("_evict", Fqn.class);




More information about the jbosscache-commits mailing list