[jbosscache-commits] JBoss Cache SVN: r4721 - core/branches/1.4.X/src/org/jboss/cache.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Thu Nov 1 08:15:10 EDT 2007


Author: manik.surtani at jboss.com
Date: 2007-11-01 08:15:10 -0400 (Thu, 01 Nov 2007)
New Revision: 4721

Modified:
   core/branches/1.4.X/src/org/jboss/cache/TreeCache.java
Log:
JBCACHE-1209 - options not reset properly in gravitatedata

Modified: core/branches/1.4.X/src/org/jboss/cache/TreeCache.java
===================================================================
--- core/branches/1.4.X/src/org/jboss/cache/TreeCache.java	2007-11-01 12:14:07 UTC (rev 4720)
+++ core/branches/1.4.X/src/org/jboss/cache/TreeCache.java	2007-11-01 12:15:10 UTC (rev 4721)
@@ -5285,18 +5285,25 @@
            throws CacheException
    {
       InvocationContext ctx = getInvocationContext();
+      Option opt = ctx.getOptionOverrides();
       try
-      {         
+      {
          ctx.setOriginLocal(false);
          // we need to get the state for this Fqn and it's sub-nodes.
 
          // for now, perform a very simple series of getData calls.
          // use a get() call into the cache to make sure cache loading takes place.
-         // no need to cache the original skipDataGravitation setting here - it will always be false of we got here!!
-         ctx.getOptionOverrides().setSkipDataGravitation(true);
+         opt.setSkipDataGravitation(true);
          DataNode actualNode = get(fqn);
-         ctx.getOptionOverrides().setSkipDataGravitation(false);
+         // The call to get(Fqn) has changed the Option instance associated
+         // with the thread. We need to restore the state of the original option,
+         // and then restore it to the thread.  This is necessary because this
+         // method can be invoked *directly* by DataGravitatorInterceptor; we need
+         // to restore whatever options were in effect when DGI was called.
+         opt.setSkipDataGravitation(false);
+         ctx.setOptionOverrides(opt);
 
+
          Fqn backupNodeFqn = null;
          if (actualNode == null && searchSubtrees)
          {
@@ -5310,9 +5317,11 @@
                   while (childNames.hasNext() && actualNode == null)
                   {
                      backupNodeFqn = BuddyManager.getBackupFqn(childNames.next().toString(), fqn);
-                     ctx.getOptionOverrides().setSkipDataGravitation(true);
+                     Option curOpt = ctx.getOptionOverrides();
+                     curOpt.setSkipDataGravitation(true);
                      actualNode = get(backupNodeFqn);
-                     ctx.getOptionOverrides().setSkipDataGravitation(false);
+                     curOpt.setSkipDataGravitation(false);
+                     ctx.setOptionOverrides(opt);
                   }
                }
             }
@@ -5364,6 +5373,10 @@
       finally
       {
          ctx.setOriginLocal(true);
+         // Make sure we restore the state of the original option,
+         // and then restore it to the thread.
+         opt.setSkipDataGravitation(false);
+         ctx.setOptionOverrides(opt);
       }
    }
 




More information about the jbosscache-commits mailing list