[jboss-cvs] JBossCache/src/org/jboss/cache/interceptors ...
Brian Stansberry
brian.stansberry at jboss.com
Fri Jul 13 15:36:25 EDT 2007
User: bstansberry
Date: 07/07/13 15:36:25
Modified: src/org/jboss/cache/interceptors Tag:
Branch_JBossCache_1_4_0
DataGravitatorInterceptor.java
CacheLoaderInterceptor.java
Log:
[JBCACHE-1139] Ensure option survives nested method call
Revision Changes Path
No revision
No revision
1.16.2.5 +13 -2 JBossCache/src/org/jboss/cache/interceptors/DataGravitatorInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: DataGravitatorInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/DataGravitatorInterceptor.java,v
retrieving revision 1.16.2.4
retrieving revision 1.16.2.5
diff -u -b -r1.16.2.4 -r1.16.2.5
--- DataGravitatorInterceptor.java 16 Mar 2007 22:07:03 -0000 1.16.2.4
+++ DataGravitatorInterceptor.java 13 Jul 2007 19:36:25 -0000 1.16.2.5
@@ -172,9 +172,20 @@
new Integer(DataNode.LOCK_TYPE_WRITE),
Boolean.FALSE});
//super.invoke(meth);
- // let's force this to go thru the whole chain, not just from here on.
+ // TxInterceptor will scrub the InvocationContext of any Option, so
+ // cache it so we can restore it
+ InvocationContext ctx = getInvocationContext();
+ Option opt = ctx.getOptionOverrides();
+ try
+ {
((Interceptor) cache.getInterceptors().get(0)).invoke(meth); // need a better way to do this
}
+ finally
+ {
+ if (opt != null)
+ ctx.setOptionOverrides(opt);
+ }
+ }
private boolean isGravitationEnabled(InvocationContext ctx)
{
1.40.2.9 +15 -2 JBossCache/src/org/jboss/cache/interceptors/CacheLoaderInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: CacheLoaderInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/CacheLoaderInterceptor.java,v
retrieving revision 1.40.2.8
retrieving revision 1.40.2.9
diff -u -b -r1.40.2.8 -r1.40.2.9
--- CacheLoaderInterceptor.java 29 Jun 2007 13:33:37 -0000 1.40.2.8
+++ CacheLoaderInterceptor.java 13 Jul 2007 19:36:25 -0000 1.40.2.9
@@ -9,6 +9,7 @@
import org.jboss.cache.TransactionTable;
import org.jboss.cache.TreeCache;
import org.jboss.cache.TreeNode;
+import org.jboss.cache.config.Option;
import org.jboss.cache.loader.AsyncCacheLoader;
import org.jboss.cache.loader.CacheLoader;
import org.jboss.cache.loader.ChainingCacheLoader;
@@ -29,7 +30,7 @@
* Loads nodes that don't exist at the time of the call into memory from the CacheLoader
*
* @author Bela Ban
- * @version $Id: CacheLoaderInterceptor.java,v 1.40.2.8 2007/06/29 13:33:37 gzamarreno Exp $
+ * @version $Id: CacheLoaderInterceptor.java,v 1.40.2.9 2007/07/13 19:36:25 bstansberry Exp $
*/
public class CacheLoaderInterceptor extends Interceptor implements CacheLoaderInterceptorMBean
{
@@ -292,8 +293,20 @@
Boolean.valueOf(recursive)});
//super.invoke(meth);
// let's force this to go thru the whole chain, not just from here on.
+ // TxInterceptor will scrub the InvocationContext of any Option, so
+ // cache it so we can restore it
+ InvocationContext ctx = getInvocationContext();
+ Option opt = ctx.getOptionOverrides();
+ try
+ {
((Interceptor) cache.getInterceptors().get(0)).invoke(meth); // need a better way to do this
}
+ finally
+ {
+ if (opt != null)
+ ctx.setOptionOverrides(opt);
+ }
+ }
/**
* Retrieves a node from memory; doesn't access the cache loader
More information about the jboss-cvs-commits
mailing list