[jbosscache-commits] JBoss Cache SVN: r5615 - 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
Tue Apr 22 06:18:45 EDT 2008


Author: mircea.markus
Date: 2008-04-22 06:18:45 -0400 (Tue, 22 Apr 2008)
New Revision: 5615

Modified:
   core/trunk/src/main/java/org/jboss/cache/NodeSPI.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/test/java/org/jboss/cache/api/NodeSPITest.java
Log:
JBCACHE-1222 - bug fixing -

Modified: core/trunk/src/main/java/org/jboss/cache/NodeSPI.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/NodeSPI.java	2008-04-22 08:12:20 UTC (rev 5614)
+++ core/trunk/src/main/java/org/jboss/cache/NodeSPI.java	2008-04-22 10:18:45 UTC (rev 5615)
@@ -375,8 +375,6 @@
     * This data should only be modified by the cache itself.
     * This method should never return null.
     * <p/>
-    * Also note that this method returns an unmodifiable reference to the underlying data map.
-    * <p/>
     * The caller needs to ensure a proper lock has been obtained prior to calling this method, otherwise a
     * {@link org.jboss.cache.lock.LockingException} will be thrown.
     * <p/>

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-22 08:12:20 UTC (rev 5614)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java	2008-04-22 10:18:45 UTC (rev 5615)
@@ -232,12 +232,13 @@
 
       Object retVal = invokeNextInterceptor(ctx, command);
       // and make sure we remove all nodes we've created for the sake of later removal.
+      //todo [mmarkus] this logic should be moved within moveNodeCommand, as it is plain removal logic
       if (ctx.getGlobalTransaction() == null)
       {
-
          for (NodeSPI nodeSPI : createdNodes) cacheData.realRemove(nodeSPI.getFqn(), true);
          cacheData.realRemove(command.getFqn(), true);
 
+         //todo end of the logic that needs to be moved
          NodeSPI n = cacheData.peek(command.getFqn(), true, false);
          if (n != 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-04-22 08:12:20 UTC (rev 5614)
+++ core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java	2008-04-22 10:18:45 UTC (rev 5615)
@@ -390,7 +390,7 @@
          InvocationContext ctx = invocationContextContainer.get();
          cacheStatusCheck(ctx);
          GlobalTransaction tx = transactionHelper.getCurrentTransaction();
-         RemoveNodeCommand command = commandsFactory.buildRemoveNodeCommand(tx, fqn, true, true, false);
+         RemoveNodeCommand command = commandsFactory.buildRemoveNodeCommand(tx, fqn, false, false, true);
          Object retval = invoker.invoke(ctx, command);
          return retval != null && (Boolean) retval;
       }

Modified: core/trunk/src/test/java/org/jboss/cache/api/NodeSPITest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/NodeSPITest.java	2008-04-22 08:12:20 UTC (rev 5614)
+++ core/trunk/src/test/java/org/jboss/cache/api/NodeSPITest.java	2008-04-22 10:18:45 UTC (rev 5615)
@@ -76,41 +76,6 @@
       nodeA.addChildDirect(B);// should work
    }
 
-   public void testDataImmutabilityAndDefensiveCopy()
-   {
-      // put some stuff in the root node
-      root.put("k", "v");
-      Map dataDirect = root.getDataDirect();
-      Set keysDirect = root.getKeysDirect();
-
-      try
-      {
-         dataDirect.remove("k");
-         fail("getDataDirect() should return an unmodifiable collection object");
-      }
-      catch (UnsupportedOperationException uoe)
-      {
-         // good; should be immutable
-      }
-
-      try
-      {
-         keysDirect.clear();
-         fail("getKeysDirect() should return an unmodifiable collection object");
-      }
-      catch (UnsupportedOperationException uoe)
-      {
-         // good; should be immutable
-      }
-
-      // now test defensive copy
-      root.put("k2", "v2");
-
-      assertTrue("root.put() should have succeeded", root.getDataDirect().containsKey("k2"));
-//      assertTrue("getDataDirect() should have made a defensive copy of the data collection object", !dataDirect.containsKey("k2"));
-      assertTrue("getKeysDirect() should have made a defensive copy of the data collection object", !keysDirect.contains("k2"));
-   }
-
    public void testChildrenImmutabilityAndDefensiveCopy()
    {
       // put some stuff in the root node




More information about the jbosscache-commits mailing list