[jbosscache-commits] JBoss Cache SVN: r5655 - 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
Thu Apr 24 06:22:15 EDT 2008
Author: mircea.markus
Date: 2008-04-24 06:22:15 -0400 (Thu, 24 Apr 2008)
New Revision: 5655
Modified:
core/trunk/src/main/java/org/jboss/cache/InvocationContext.java
core/trunk/src/main/java/org/jboss/cache/interceptors/Interceptor.java
core/trunk/src/main/java/org/jboss/cache/invocation/InterceptorChain.java
core/trunk/src/test/java/org/jboss/cache/invocationcontext/TransactionTest.java
Log:
JBCACHE-1222 - fixed invocation context tests
Modified: core/trunk/src/main/java/org/jboss/cache/InvocationContext.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/InvocationContext.java 2008-04-24 09:41:31 UTC (rev 5654)
+++ core/trunk/src/main/java/org/jboss/cache/InvocationContext.java 2008-04-24 10:22:15 UTC (rev 5655)
@@ -9,6 +9,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.commands.CacheCommand;
+import org.jboss.cache.commands.functional.MarshallableCommand;
import org.jboss.cache.config.Option;
import org.jboss.cache.lock.NodeLock;
import org.jboss.cache.marshall.MethodCall;
@@ -38,6 +39,7 @@
private boolean cacheLoaderHasMods;
private boolean localRollbackOnly;
private MethodCall methodCall;
+ @Deprecated
private CacheCommand executingCommand;
// used to store cache peeks within the scope of a single context. Performing a cache peek can be a huge bottle neck.
@@ -361,9 +363,23 @@
*/
public MethodCall getMethodCall()
{
+ if (methodCall == null)
+ {
+ methodCall = createMethodCall((MarshallableCommand) getExecutingCommand());
+ }
return methodCall;
}
+ @SuppressWarnings("deprecated")
+ private MethodCall createMethodCall(MarshallableCommand command)
+ {
+ MethodCall call = new MethodCall();
+ call.setMethodId(command.getCommandId());
+ call.setArgs(command.getParameters());
+ return call;
+ }
+
+
/**
* Sets the method call associated with this invocation.
*
@@ -402,11 +418,21 @@
return timeout;
}
+ /**
+ * This is only used for backward compatibility with old interceptors implementation and should <b>NOT</b> be
+ * use by any new custom interceptors. The commands is now passed in as the second param in each implementing
+ * handlers (handler = method in ChainedInterceptor class)
+ */
+ @Deprecated
public void setExecutingCommand(CacheCommand cacheCommand)
{
this.executingCommand = cacheCommand;
}
+ /**
+ * @see #setExecutingCommand(org.jboss.cache.commands.CacheCommand)
+ */
+ @Deprecated
public CacheCommand getExecutingCommand()
{
return executingCommand;
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/Interceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/Interceptor.java 2008-04-24 09:41:31 UTC (rev 5654)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/Interceptor.java 2008-04-24 10:22:15 UTC (rev 5655)
@@ -142,24 +142,6 @@
public NodeSPI peekNode(InvocationContext ctx, Fqn f, boolean forceRefresh, boolean includeDeletedNodes, boolean includeInvalidNodes)
{
return cache.peek(f, includeDeletedNodes, includeInvalidNodes);
-
- // Disabling this for now, until we can prove that it is in fact beneficial.
- // preliminary profiling tests show that it is not.
-
-// NodeSPI n;
-// if (forceRefresh || (n = ctx.getPeekedNode(f)) == null)
-// {
-// n = cache.peek(f, true, true);
-// // put this in the invocation cache
-// ctx.savePeekedNode(n, f);
-// }
-//
-// if (n != null)
-// {
-// if (!includeDeletedNodes && n.isDeleted()) return null;
-// if (!includeInvalidNodes && !n.isValid()) return null;
-// }
-// return n;
}
@Override
Modified: core/trunk/src/main/java/org/jboss/cache/invocation/InterceptorChain.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/invocation/InterceptorChain.java 2008-04-24 09:41:31 UTC (rev 5654)
+++ core/trunk/src/main/java/org/jboss/cache/invocation/InterceptorChain.java 2008-04-24 10:22:15 UTC (rev 5655)
@@ -5,10 +5,8 @@
import org.jboss.cache.CacheException;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.commands.CacheCommand;
-import org.jboss.cache.commands.functional.MarshallableCommand;
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.interceptors.base.ChainedInterceptor;
-import org.jboss.cache.marshall.MethodCall;
import java.util.ArrayList;
import java.util.Collections;
@@ -234,8 +232,6 @@
public Object invoke(InvocationContext ctx, CacheCommand command)
{
ctx.setExecutingCommand(command);
- // ensure legacy MethodCall is available for interceptor implementations.
- ctx.setMethodCall(createMethodCall((MarshallableCommand) command));
try
{
return command.accept(ctx, firstInChain);
@@ -254,15 +250,6 @@
}
}
- @SuppressWarnings("deprecated")
- private MethodCall createMethodCall(MarshallableCommand command)
- {
- MethodCall call = new MethodCall();
- call.setMethodId(command.getCommandId());
- call.setArgs(command.getParameters());
- return call;
- }
-
/**
* Similar to {@link #invoke(org.jboss.cache.InvocationContext, org.jboss.cache.commands.CacheCommand)}, but
* constructs a invocation context on the fly, using {@link InvocationContextContainer#get()}
Modified: core/trunk/src/test/java/org/jboss/cache/invocationcontext/TransactionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/invocationcontext/TransactionTest.java 2008-04-24 09:41:31 UTC (rev 5654)
+++ core/trunk/src/test/java/org/jboss/cache/invocationcontext/TransactionTest.java 2008-04-24 10:22:15 UTC (rev 5655)
@@ -128,7 +128,6 @@
assertNull("Tx should have been scrubbed", cache.getInvocationContext().getTransaction());
assertNull("Gtx should have been scrubbed", cache.getInvocationContext().getGlobalTransaction());
- assertEquals("MethodCall should have been scrubbed", null, cache.getInvocationContext().getMethodCall());
}
private void setUpOnePhaseCache()
More information about the jbosscache-commits
mailing list