[jbosscache-commits] JBoss Cache SVN: r4720 - core/tags/1.4.1.SP6/src/org/jboss/cache.

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


Author: manik.surtani at jboss.com
Date: 2007-11-01 08:14:07 -0400 (Thu, 01 Nov 2007)
New Revision: 4720

Modified:
   core/tags/1.4.1.SP6/src/org/jboss/cache/TreeCache.java
Log:
JBCACHE-1209 - options in gravitatedata call not properly reset

Modified: core/tags/1.4.1.SP6/src/org/jboss/cache/TreeCache.java
===================================================================
--- core/tags/1.4.1.SP6/src/org/jboss/cache/TreeCache.java	2007-11-01 11:26:37 UTC (rev 4719)
+++ core/tags/1.4.1.SP6/src/org/jboss/cache/TreeCache.java	2007-11-01 12:14:07 UTC (rev 4720)
@@ -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);
+         // use a get() call into the cache to make sure cache loading takes place.         
+         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