[jboss-cvs] JBossCache/src/org/jboss/cache/interceptors ...
Manik Surtani
msurtani at jboss.com
Wed Aug 16 13:11:39 EDT 2006
User: msurtani
Date: 06/08/16 13:11:39
Modified: src/org/jboss/cache/interceptors CallInterceptor.java
Interceptor.java
Log:
Fixed problem with static variable in Interceptor class
Revision Changes Path
1.12 +10 -2 JBossCache/src/org/jboss/cache/interceptors/CallInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: CallInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/CallInterceptor.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- CallInterceptor.java 14 Aug 2006 17:20:34 -0000 1.11
+++ CallInterceptor.java 16 Aug 2006 17:11:39 -0000 1.12
@@ -3,6 +3,7 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.GlobalTransaction;
import org.jboss.cache.InvocationContext;
+import org.jboss.cache.TreeCache;
import org.jboss.cache.config.Option;
import org.jboss.cache.marshall.MethodDeclarations;
import org.jgroups.blocks.MethodCall;
@@ -21,11 +22,12 @@
* this interceptor unless it is a call the OptimisticNodeInterceptor knows nothing about.
*
* @author Bela Ban
- * @version $Id: CallInterceptor.java,v 1.11 2006/08/14 17:20:34 msurtani Exp $
+ * @version $Id: CallInterceptor.java,v 1.12 2006/08/16 17:11:39 msurtani Exp $
*/
public class CallInterceptor extends Interceptor
{
private static Set<Method> transactionLifecycleMethods = new HashSet<Method>();
+ private TreeCache treeCache;
static
{
transactionLifecycleMethods.add(MethodDeclarations.commitMethod);
@@ -40,6 +42,11 @@
super.setCache(cache);
}
+ public void setTreeCacheInstance(TreeCache c)
+ {
+ treeCache = c;
+ }
+
public Object invoke(MethodCall m) throws Throwable
{
@@ -50,7 +57,8 @@
if (log.isTraceEnabled()) log.trace("Passing up method " + m + " so it gets invoked on cache.");
try
{
- retval = super.invoke(m);
+ //retval = super.invoke(m);
+ retval = m.invoke(treeCache);
}
catch (Throwable t)
{
1.18 +3 -16 JBossCache/src/org/jboss/cache/interceptors/Interceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Interceptor.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/Interceptor.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- Interceptor.java 14 Aug 2006 17:20:34 -0000 1.17
+++ Interceptor.java 16 Aug 2006 17:11:39 -0000 1.18
@@ -24,7 +24,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.CacheSPI;
-import org.jboss.cache.TreeCache;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.marshall.JBCMethodCall;
@@ -41,13 +40,11 @@
* Class representing an interceptor.
* <em>Note that this will be replaced by {@link org.jboss.aop.advice.Interceptor} in one of the next releases</em>
* @author Bela Ban
- * @version $Id: Interceptor.java,v 1.17 2006/08/14 17:20:34 msurtani Exp $
+ * @version $Id: Interceptor.java,v 1.18 2006/08/16 17:11:39 msurtani Exp $
*/
public abstract class Interceptor implements InterceptorMBean {
- protected Interceptor next=null;
+ protected Interceptor next=null, last = null;
protected CacheSPI cache;
- // TODO: MANIK: internalise/hide this reference from other interceptors!!
- private static TreeCache treecache;
protected Log log=null;
protected Configuration configuration;
private boolean statsEnabled = false;
@@ -70,22 +67,12 @@
this.configuration = cache.getConfiguration();
}
- public static void setTreeCacheInstance(TreeCache cache)
- {
- treecache = cache;
- }
-
public Object invoke(MethodCall m) throws Throwable
{
if (next != null && !InvocationContext.getOptionOverrides().isBypassInterceptorChain())
return next.invoke(m);
else
- return invokeOnTreeCache(m);
- }
-
- private Object invokeOnTreeCache(MethodCall m) throws Throwable
- {
- return m.invoke(treecache);
+ return last.invoke(m);
}
public boolean getStatisticsEnabled()
More information about the jboss-cvs-commits
mailing list