[jboss-cvs] JBossCache/src/org/jboss/cache/interceptors ...
Manik Surtani
msurtani at jboss.com
Fri Aug 18 11:40:39 EDT 2006
User: msurtani
Date: 06/08/18 11:40:39
Modified: src/org/jboss/cache/interceptors
ActivationInterceptor.java BaseRpcInterceptor.java
CacheLoaderInterceptor.java
CacheStoreInterceptor.java CallInterceptor.java
CreateIfNotExistsInterceptor.java
DataGravitatorInterceptor.java Interceptor.java
InvalidationInterceptor.java
OptimisticCreateIfNotExistsInterceptor.java
OptimisticLockingInterceptor.java
OptimisticNodeInterceptor.java
OptimisticReplicationInterceptor.java
OptimisticValidatorInterceptor.java
PessimisticLockInterceptor.java
ReplicationInterceptor.java TxInterceptor.java
UnlockInterceptor.java
Log:
Habanero stabilisation efforts - scoping problems with more than one cache instance in the same thread/namespace.
Revision Changes Path
1.31 +2 -3 JBossCache/src/org/jboss/cache/interceptors/ActivationInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ActivationInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/ActivationInterceptor.java,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -b -r1.30 -r1.31
--- ActivationInterceptor.java 17 Aug 2006 17:34:59 -0000 1.30
+++ ActivationInterceptor.java 18 Aug 2006 15:40:39 -0000 1.31
@@ -4,7 +4,6 @@
import org.jboss.cache.DataNode;
import org.jboss.cache.Fqn;
import org.jboss.cache.GlobalTransaction;
-import org.jboss.cache.InvocationContext;
import org.jboss.cache.Modification;
import org.jboss.cache.TransactionEntry;
import org.jboss.cache.TransactionTable;
@@ -28,7 +27,7 @@
* their attributes have been initialized and their children have been loaded in memory.
*
* @author <a href="mailto:{hmesha at novell.com}">{Hany Mesha}</a>
- * @version $Id: ActivationInterceptor.java,v 1.30 2006/08/17 17:34:59 msurtani Exp $
+ * @version $Id: ActivationInterceptor.java,v 1.31 2006/08/18 15:40:39 msurtani Exp $
*/
public class ActivationInterceptor extends CacheLoaderInterceptor implements ActivationInterceptorMBean {
@@ -68,7 +67,7 @@
// Could be TRANSACTIONAL. If so, we register for TX completion (if we haven't done so yet)
if(tx_mgr != null && tx_mgr.getTransaction() != null) {
- GlobalTransaction gtx = InvocationContext.getCurrent().getGlobalTransaction();
+ GlobalTransaction gtx = cache.getInvocationContext().getGlobalTransaction();
switch (m.getMethodId())
{
case MethodDeclarations.commitMethod_id:
1.17 +2 -3 JBossCache/src/org/jboss/cache/interceptors/BaseRpcInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: BaseRpcInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/BaseRpcInterceptor.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- BaseRpcInterceptor.java 19 Jul 2006 21:34:43 -0000 1.16
+++ BaseRpcInterceptor.java 18 Aug 2006 15:40:39 -0000 1.17
@@ -4,13 +4,12 @@
package org.jboss.cache.interceptors;
import org.jboss.cache.CacheSPI;
-import org.jboss.cache.InvocationContext;
import org.jboss.cache.buddyreplication.BuddyManager;
import org.jboss.cache.marshall.JBCMethodCall;
import org.jboss.cache.marshall.MethodCallFactory;
import org.jboss.cache.marshall.MethodDeclarations;
-import org.jgroups.blocks.MethodCall;
import org.jgroups.Address;
+import org.jgroups.blocks.MethodCall;
import java.util.Iterator;
import java.util.List;
@@ -114,7 +113,7 @@
return mods.size() > 0;
case MethodDeclarations.commitMethod_id:
case MethodDeclarations.rollbackMethod_id:
- return InvocationContext.getCurrent().isTxHasMods();
+ return cache.getInvocationContext().isTxHasMods();
default :
return false;
}
1.45 +5 -6 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.44
retrieving revision 1.45
diff -u -b -r1.44 -r1.45
--- CacheLoaderInterceptor.java 17 Aug 2006 17:34:59 -0000 1.44
+++ CacheLoaderInterceptor.java 18 Aug 2006 15:40:39 -0000 1.45
@@ -23,7 +23,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.44 2006/08/17 17:34:59 msurtani Exp $
+ * @version $Id: CacheLoaderInterceptor.java,v 1.45 2006/08/18 15:40:39 msurtani Exp $
*/
public class CacheLoaderInterceptor extends BaseCacheLoaderInterceptor implements CacheLoaderInterceptorMBean
{
@@ -90,7 +90,7 @@
Map nodeData = null;
boolean initNode = false; // keep uninitialized
Object key = null;
- InvocationContext ctx = InvocationContext.getCurrent();
+ InvocationContext ctx = cache.getInvocationContext();
TransactionEntry entry = null;
GlobalTransaction gtx = null;
if ((gtx = ctx.getGlobalTransaction()) != null)
@@ -304,7 +304,7 @@
*/
private boolean wasRemovedInTx(Fqn fqn)
{
- GlobalTransaction t = InvocationContext.getCurrent().getGlobalTransaction();
+ GlobalTransaction t = cache.getInvocationContext().getGlobalTransaction();
if (t == null)
return false;
TransactionEntry entry = txTable.get(t);
@@ -346,7 +346,7 @@
private Node createTempNode(Fqn fqn, TransactionEntry entry) throws Exception
{
Node n = createNodes(fqn, entry);
- InvocationContext.getOptionOverrides().setBypassInterceptorChain(true);
+ cache.getInvocationContext().getOptionOverrides().setBypassInterceptorChain(true);
n.put(TreeCache.UNINITIALIZED, null);
if (log.isTraceEnabled())
log.trace("createTempNode n " + n);
@@ -373,9 +373,8 @@
if (child_node == null)
{
- Option o = InvocationContext.getOptionOverrides();
+ Option o = cache.getInvocationContext().getOptionOverrides();
o.setBypassInterceptorChain(true);
- InvocationContext.setOptionOverrides(o);
if (last)
{
child_node = n.addChild(new Fqn(child_name));
1.28 +5 -6 JBossCache/src/org/jboss/cache/interceptors/CacheStoreInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: CacheStoreInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/CacheStoreInterceptor.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- CacheStoreInterceptor.java 19 Jul 2006 21:34:43 -0000 1.27
+++ CacheStoreInterceptor.java 18 Aug 2006 15:40:39 -0000 1.28
@@ -7,7 +7,6 @@
import org.jboss.cache.Modification;
import org.jboss.cache.TransactionEntry;
import org.jboss.cache.TransactionTable;
-import org.jboss.cache.InvocationContext;
import org.jboss.cache.config.CacheLoaderConfig;
import org.jboss.cache.marshall.JBCMethodCall;
import org.jboss.cache.marshall.MethodDeclarations;
@@ -26,7 +25,7 @@
* Writes modifications back to the store on the way out: stores modifications back
* through the CacheLoader, either after each method call (no TXs), or at TX commit.
* @author Bela Ban
- * @version $Id: CacheStoreInterceptor.java,v 1.27 2006/07/19 21:34:43 msurtani Exp $
+ * @version $Id: CacheStoreInterceptor.java,v 1.28 2006/08/18 15:40:39 msurtani Exp $
*/
public class CacheStoreInterceptor extends BaseCacheLoaderInterceptor implements CacheStoreInterceptorMBean
{
@@ -60,7 +59,7 @@
// if this is a shared cache loader and the call is of remote origin, pass up the chain. - Manik
// see http://www.jboss.com/index.html?module=bb&op=viewtopic&t=76090
- if (!InvocationContext.getCurrent().isOriginLocal() && loaderConfig.isShared()) {
+ if (!cache.getInvocationContext().isOriginLocal() && loaderConfig.isShared()) {
log.trace("Passing up method call and bypassing this interceptor since the cache loader is shared and this call originated remotely.");
return super.invoke(m);
}
@@ -79,11 +78,11 @@
if (tx_mgr != null && tx_mgr.getTransaction() != null) {
// we have a tx running.
log.trace("transactional so don't put stuff in the cloader yet.");
- GlobalTransaction gtx = InvocationContext.getCurrent().getGlobalTransaction();
+ GlobalTransaction gtx = cache.getInvocationContext().getGlobalTransaction();
switch (m.getMethodId())
{
case MethodDeclarations.commitMethod_id:
- if (InvocationContext.getCurrent().isTxHasMods()) {
+ if (cache.getInvocationContext().isTxHasMods()) {
// this is a commit call.
if (log.isTraceEnabled()) log.trace("Calling loader.commit() for gtx " + gtx);
// sync call (a write) on the loader
@@ -110,7 +109,7 @@
}
break;
case MethodDeclarations.rollbackMethod_id:
- if (InvocationContext.getCurrent().isTxHasMods()) {
+ if (cache.getInvocationContext().isTxHasMods()) {
// this is a rollback method
if (preparingTxs.containsKey(gtx))
{
1.13 +3 -3 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.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- CallInterceptor.java 16 Aug 2006 17:11:39 -0000 1.12
+++ CallInterceptor.java 18 Aug 2006 15:40:39 -0000 1.13
@@ -22,7 +22,7 @@
* this interceptor unless it is a call the OptimisticNodeInterceptor knows nothing about.
*
* @author Bela Ban
- * @version $Id: CallInterceptor.java,v 1.12 2006/08/16 17:11:39 msurtani Exp $
+ * @version $Id: CallInterceptor.java,v 1.13 2006/08/18 15:40:39 msurtani Exp $
*/
public class CallInterceptor extends Interceptor
{
@@ -70,7 +70,7 @@
if (log.isTraceEnabled()) log.trace("Suppressing invocation of method " + m + " on cache.");
}
- InvocationContext ctx = InvocationContext.getCurrent();
+ InvocationContext ctx = cache.getInvocationContext();
Transaction tx = ctx.getTransaction();
if (tx != null && isValid(tx))
{
@@ -102,7 +102,7 @@
}
else
{
- Option o = InvocationContext.getCurrent().getOptionOverrides();
+ Option o = cache.getInvocationContext().getOptionOverrides();
if (o != null && o.isCacheModeLocal())
{
log.debug("Not adding method to modification list since cache mode local is set.");
1.15 +2 -2 JBossCache/src/org/jboss/cache/interceptors/CreateIfNotExistsInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: CreateIfNotExistsInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/CreateIfNotExistsInterceptor.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- CreateIfNotExistsInterceptor.java 17 Aug 2006 17:34:59 -0000 1.14
+++ CreateIfNotExistsInterceptor.java 18 Aug 2006 15:40:39 -0000 1.15
@@ -16,7 +16,7 @@
* Handles putXXX() methods: if the given node doesn't exist, it will be created
* (depending on the create_if_not_exists argument)
* @author Bela Ban
- * @version $Id: CreateIfNotExistsInterceptor.java,v 1.14 2006/08/17 17:34:59 msurtani Exp $
+ * @version $Id: CreateIfNotExistsInterceptor.java,v 1.15 2006/08/18 15:40:39 msurtani Exp $
* @deprecated This code is not used anymore and will be removed in a future release
*/
public class CreateIfNotExistsInterceptor extends Interceptor {
@@ -137,7 +137,7 @@
addFqnToPutList(fqn, put_lock);
findAndBlockOnRemove(fqn, remove_lock);
if(!cache.hasChild(fqn)) {
- GlobalTransaction gtx=InvocationContext.getCurrent().getGlobalTransaction();
+ GlobalTransaction gtx=cache.getInvocationContext().getGlobalTransaction();
if(log.isTraceEnabled())
log.trace("creating node " + fqn);
createNode(fqn, gtx);
1.21 +11 -11 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.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- DataGravitatorInterceptor.java 17 Aug 2006 17:34:59 -0000 1.20
+++ DataGravitatorInterceptor.java 18 Aug 2006 15:40:39 -0000 1.21
@@ -66,9 +66,9 @@
public Object invoke(MethodCall call) throws Throwable
{
JBCMethodCall m = (JBCMethodCall) call;
-// if (isGravitationEnabled(InvocationContext.getCurrent()))
+// if (isGravitationEnabled(cache.getInvocationContext()))
// {
-// Option opt = InvocationContext.getCurrent().getOptionOverrides();
+// Option opt = cache.getInvocationContext().getOptionOverrides();
// if (opt == null || !opt.isSuppressDataGravitation())
// {
if (log.isTraceEnabled()) log.trace("Invoked with method call " + m);
@@ -76,7 +76,7 @@
// Transactional lifecycle methods should be handled regardless of whether data gravitation is enabled or not.
if (!isTransactionLifecycleMethod(m))
{
- if (isGravitationEnabled(InvocationContext.getCurrent()))
+ if (isGravitationEnabled(cache.getInvocationContext()))
{
// test that the Fqn being requested exists locally in the cache.
Fqn fqn = extractFqn(m.getMethodId(), m.getArgs());
@@ -135,20 +135,20 @@
case MethodDeclarations.prepareMethod_id:
case MethodDeclarations.optimisticPrepareMethod_id:
Object o = super.invoke(m);
- doPrepare(InvocationContext.getCurrent().getGlobalTransaction());
+ doPrepare(cache.getInvocationContext().getGlobalTransaction());
return o;
case MethodDeclarations.rollbackMethod_id:
- transactionMods.remove(InvocationContext.getCurrent().getGlobalTransaction());
+ transactionMods.remove(cache.getInvocationContext().getGlobalTransaction());
return super.invoke(m);
case MethodDeclarations.commitMethod_id:
- doCommit(InvocationContext.getCurrent().getGlobalTransaction());
- transactionMods.remove(InvocationContext.getCurrent().getGlobalTransaction());
+ doCommit(cache.getInvocationContext().getGlobalTransaction());
+ transactionMods.remove(cache.getInvocationContext().getGlobalTransaction());
return super.invoke(m);
}
}
catch (Throwable throwable)
{
- transactionMods.remove(InvocationContext.getCurrent().getGlobalTransaction());
+ transactionMods.remove(cache.getInvocationContext().getGlobalTransaction());
throw throwable;
}
}
@@ -280,11 +280,11 @@
// backupDataCleanup = MethodCallFactory.create(MethodDeclarations.evictNodeMethodLocal, new Object[]{backup.backupFqn});
// }
- JBCMethodCall cleanup = MethodCallFactory.create(MethodDeclarations.dataGravitationCleanupMethod, new Object[]{InvocationContext.getCurrent().getGlobalTransaction(), backup.primaryFqn, backup.backupFqn});
+ JBCMethodCall cleanup = MethodCallFactory.create(MethodDeclarations.dataGravitationCleanupMethod, new Object[]{cache.getInvocationContext().getGlobalTransaction(), backup.primaryFqn, backup.backupFqn});
if (log.isTraceEnabled()) log.trace("Performing cleanup on [" +backup.primaryFqn+ "]");
- GlobalTransaction gtx = InvocationContext.getCurrent().getGlobalTransaction();
+ GlobalTransaction gtx = cache.getInvocationContext().getGlobalTransaction();
if (gtx == null)
{
// broadcast removes
@@ -362,7 +362,7 @@
private void createNode(boolean localOnly, List nodeData) throws CacheException
{
Iterator nodes = nodeData.iterator();
- GlobalTransaction gtx = InvocationContext.getCurrent().getGlobalTransaction();
+ GlobalTransaction gtx = cache.getInvocationContext().getGlobalTransaction();
while (nodes.hasNext())
{
1.19 +2 -3 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.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- Interceptor.java 16 Aug 2006 17:11:39 -0000 1.18
+++ Interceptor.java 18 Aug 2006 15:40:39 -0000 1.19
@@ -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.InvocationContext;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.marshall.JBCMethodCall;
import org.jboss.cache.marshall.MethodDeclarations;
@@ -40,7 +39,7 @@
* 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.18 2006/08/16 17:11:39 msurtani Exp $
+ * @version $Id: Interceptor.java,v 1.19 2006/08/18 15:40:39 msurtani Exp $
*/
public abstract class Interceptor implements InterceptorMBean {
protected Interceptor next=null, last = null;
@@ -69,7 +68,7 @@
public Object invoke(MethodCall m) throws Throwable
{
- if (next != null && !InvocationContext.getOptionOverrides().isBypassInterceptorChain())
+ if (next != null && !cache.getInvocationContext().getOptionOverrides().isBypassInterceptorChain())
return next.invoke(m);
else
return last.invoke(m);
1.22 +1 -1 JBossCache/src/org/jboss/cache/interceptors/InvalidationInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: InvalidationInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/InvalidationInterceptor.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- InvalidationInterceptor.java 20 Jul 2006 09:03:51 -0000 1.21
+++ InvalidationInterceptor.java 18 Aug 2006 15:40:39 -0000 1.22
@@ -46,7 +46,7 @@
public Object invoke(MethodCall call) throws Throwable
{
JBCMethodCall m = (JBCMethodCall) call;
- InvocationContext ctx = InvocationContext.getCurrent();
+ InvocationContext ctx = cache.getInvocationContext();
Option optionOverride = ctx.getOptionOverrides();
if (optionOverride != null && optionOverride.isCacheModeLocal() && ctx.getTransaction() == null)
{
1.24 +3 -3 JBossCache/src/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: OptimisticCreateIfNotExistsInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- OptimisticCreateIfNotExistsInterceptor.java 17 Aug 2006 17:34:59 -0000 1.23
+++ OptimisticCreateIfNotExistsInterceptor.java 18 Aug 2006 15:40:39 -0000 1.24
@@ -49,7 +49,7 @@
}
if (!cache.hasChild(fqn))
{
- GlobalTransaction gtx = InvocationContext.getCurrent().getGlobalTransaction();
+ GlobalTransaction gtx = cache.getInvocationContext().getGlobalTransaction();
if (gtx != null)
{
createNode(fqn, gtx, txTable);
@@ -98,7 +98,7 @@
// how many levels do we have?
int treeNodeSize = fqn.size();
- InvocationContext ctx = InvocationContext.getCurrent();
+ InvocationContext ctx = cache.getInvocationContext();
// try and get the root from the transaction
TransactionWorkspace workspace = transactionEntry.getTransactionWorkSpace();
@@ -174,7 +174,7 @@
versionToPassIn = version;
}
- DataNode tempNode = (DataNode) workspaceNode.createChild(childName, copy, workspaceNode.getNode(), cache, versionToPassIn);
+ DataNode tempNode = (DataNode) workspaceNode.createChild(childName, copy, workspaceNode.getNode(), ((TreeCacheProxyImpl) cache).treeCache, versionToPassIn);
childWorkspaceNode = NodeFactory.getInstance().createWorkspaceNode(tempNode, workspace);
1.19 +1 -1 JBossCache/src/org/jboss/cache/interceptors/OptimisticLockingInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: OptimisticLockingInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/OptimisticLockingInterceptor.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- OptimisticLockingInterceptor.java 14 Aug 2006 17:52:34 -0000 1.18
+++ OptimisticLockingInterceptor.java 18 Aug 2006 15:40:39 -0000 1.19
@@ -40,7 +40,7 @@
public Object invoke(MethodCall call) throws Throwable
{
JBCMethodCall m = (JBCMethodCall) call;
- InvocationContext ctx = InvocationContext.getCurrent();
+ InvocationContext ctx = cache.getInvocationContext();
Object retval = null;
Method meth = m.getMethod();
1.24 +1 -1 JBossCache/src/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: OptimisticNodeInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- OptimisticNodeInterceptor.java 17 Aug 2006 17:34:59 -0000 1.23
+++ OptimisticNodeInterceptor.java 18 Aug 2006 15:40:39 -0000 1.24
@@ -33,7 +33,7 @@
public Object invoke(MethodCall call) throws Throwable
{
JBCMethodCall m = (JBCMethodCall) call;
- InvocationContext ctx = InvocationContext.getCurrent();
+ InvocationContext ctx = cache.getInvocationContext();
Transaction tx = ctx.getTransaction();
Method meth = m.getMethod();
Object[] args = m.getArgs();
1.24 +1 -1 JBossCache/src/org/jboss/cache/interceptors/OptimisticReplicationInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: OptimisticReplicationInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/OptimisticReplicationInterceptor.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- OptimisticReplicationInterceptor.java 20 Jul 2006 09:03:51 -0000 1.23
+++ OptimisticReplicationInterceptor.java 18 Aug 2006 15:40:39 -0000 1.24
@@ -36,7 +36,7 @@
public Object invoke(MethodCall call) throws Throwable
{
JBCMethodCall m = (JBCMethodCall) call;
- InvocationContext ctx = InvocationContext.getCurrent();
+ InvocationContext ctx = cache.getInvocationContext();
Option optionOverride = ctx.getOptionOverrides();
if (optionOverride != null && optionOverride.isCacheModeLocal() && ctx.getTransaction() == null)
{
1.29 +5 -5 JBossCache/src/org/jboss/cache/interceptors/OptimisticValidatorInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: OptimisticValidatorInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/OptimisticValidatorInterceptor.java,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- OptimisticValidatorInterceptor.java 17 Aug 2006 17:34:59 -0000 1.28
+++ OptimisticValidatorInterceptor.java 18 Aug 2006 15:40:39 -0000 1.29
@@ -43,7 +43,7 @@
public Object invoke(MethodCall call) throws Throwable
{
JBCMethodCall m = (JBCMethodCall) call;
- InvocationContext ctx = InvocationContext.getCurrent();
+ InvocationContext ctx = cache.getInvocationContext();
Transaction tx = ctx.getTransaction();
GlobalTransaction gtx = ctx.getGlobalTransaction();
Object retval = null;
@@ -108,13 +108,13 @@
workspaceNode = (WorkspaceNode) it.next();
Fqn fqn = workspaceNode.getFqn();
if (trace) log.trace("validating version for node " + fqn);
- Option o = InvocationContext.getOptionOverrides();
+ Option o = cache.getInvocationContext().getOptionOverrides();
o.setBypassInterceptorChain(true);
- InvocationContext.setOptionOverrides(o);
+ cache.getInvocationContext().setOptionOverrides(o);
OptimisticTreeNode realNode = (OptimisticTreeNode) cache.get(fqn);
- o = InvocationContext.getOptionOverrides();
+ o = cache.getInvocationContext().getOptionOverrides();
o.setBypassInterceptorChain(false);
- InvocationContext.setOptionOverrides(o);
+ cache.getInvocationContext().setOptionOverrides(o);
// if this is a newly created node then we expect the underlying node to be null.
1.25 +5 -7 JBossCache/src/org/jboss/cache/interceptors/PessimisticLockInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: PessimisticLockInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/PessimisticLockInterceptor.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- PessimisticLockInterceptor.java 14 Aug 2006 17:52:34 -0000 1.24
+++ PessimisticLockInterceptor.java 18 Aug 2006 15:40:39 -0000 1.25
@@ -38,7 +38,7 @@
* current method and unlock when the method returns.
*
* @author Bela Ban
- * @version $Id: PessimisticLockInterceptor.java,v 1.24 2006/08/14 17:52:34 msurtani Exp $
+ * @version $Id: PessimisticLockInterceptor.java,v 1.25 2006/08/18 15:40:39 msurtani Exp $
*/
public class PessimisticLockInterceptor extends Interceptor {
TransactionTable tx_table=null;
@@ -63,10 +63,10 @@
Fqn fqn=null;
DataNode.LockType lock_type=DataNode.LockType.NONE;
Object[] args=m.getArgs();
- InvocationContext ctx = InvocationContext.getCurrent();
+ InvocationContext ctx = cache.getInvocationContext();
if (log.isTraceEnabled()) log.trace("PessimisticLockInterceptor invoked for method " + m);
- if (InvocationContext.getOptionOverrides() != null && InvocationContext.getOptionOverrides().isSuppressLocking())
+ if (cache.getInvocationContext().getOptionOverrides() != null && cache.getInvocationContext().getOptionOverrides().isSuppressLocking())
{
log.trace("Suppressing locking");
switch (m.getMethodId())
@@ -213,16 +213,14 @@
for(int i=0; i < treeNodeSize; i++) {
child_name=fqn.get(i);
- Option o = InvocationContext.getOptionOverrides();
+ Option o = cache.getInvocationContext().getOptionOverrides();
o.setBypassInterceptorChain(true);
- InvocationContext.setOptionOverrides(o);
child_node = n.getChild(new Fqn(child_name));
if (child_node == null && createIfNotExists)
{
- o = InvocationContext.getOptionOverrides();
+ o = cache.getInvocationContext().getOptionOverrides();
o.setBypassInterceptorChain(true);
- InvocationContext.setOptionOverrides(o);
child_node= n.addChild(new Fqn(child_name));
}
1.35 +2 -2 JBossCache/src/org/jboss/cache/interceptors/ReplicationInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ReplicationInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/ReplicationInterceptor.java,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -b -r1.34 -r1.35
--- ReplicationInterceptor.java 20 Jul 2006 09:03:51 -0000 1.34
+++ ReplicationInterceptor.java 18 Aug 2006 15:40:39 -0000 1.35
@@ -16,7 +16,7 @@
* 'side-ways' (see docs/design/Refactoring.txt).
*
* @author Bela Ban
- * @version $Id: ReplicationInterceptor.java,v 1.34 2006/07/20 09:03:51 msurtani Exp $
+ * @version $Id: ReplicationInterceptor.java,v 1.35 2006/08/18 15:40:39 msurtani Exp $
*/
public class ReplicationInterceptor extends BaseRpcInterceptor
{
@@ -24,7 +24,7 @@
public Object invoke(MethodCall call) throws Throwable
{
JBCMethodCall m = (JBCMethodCall) call;
- InvocationContext ctx = InvocationContext.getCurrent();
+ InvocationContext ctx = cache.getInvocationContext();
GlobalTransaction gtx = ctx.getGlobalTransaction();
boolean isLocalCommitOrRollback = gtx != null && !gtx.isRemote() && (m.getMethodId() == MethodDeclarations.commitMethod_id || m.getMethodId() == MethodDeclarations.rollbackMethod_id);
1.55 +13 -13 JBossCache/src/org/jboss/cache/interceptors/TxInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: TxInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/TxInterceptor.java,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -b -r1.54 -r1.55
--- TxInterceptor.java 15 Aug 2006 21:02:23 -0000 1.54
+++ TxInterceptor.java 18 Aug 2006 15:40:39 -0000 1.55
@@ -83,7 +83,7 @@
// bypass for buddy group org metod calls.
if (isBuddyGroupOrganisationMethod(m)) return super.invoke(m);
- InvocationContext ctx = InvocationContext.getCurrent();
+ InvocationContext ctx = cache.getInvocationContext();
final Transaction suspendedTransaction;
boolean scrubTxsOnExit = false;
@@ -329,7 +329,7 @@
*/
private Object handleNonTxMethod(MethodCall m) throws Throwable
{
- InvocationContext ctx = InvocationContext.getCurrent();
+ InvocationContext ctx = cache.getInvocationContext();
Transaction tx = ctx.getTransaction();
Object result;
// if there is no current tx and we're using opt locking, we need to use an implicit tx.
@@ -396,7 +396,7 @@
}
// make sure we attach this gtx to the invocation context.
- InvocationContext.getCurrent().setGlobalTransaction(gtx);
+ cache.getInvocationContext().setGlobalTransaction(gtx);
return m;
}
@@ -577,7 +577,7 @@
resumeCurrentTxOnCompletion = true;
txManager.resume(ltx);
// make sure we set this in the ctx
- InvocationContext.getCurrent().setTransaction( ltx );
+ cache.getInvocationContext().setTransaction( ltx );
}
if (log.isDebugEnabled()) log.debug(" executing " + m + "() with local TX " + ltx + " under global tx " + gtx);
@@ -607,7 +607,7 @@
if (currentTx != null)
{
txManager.resume(currentTx);
- InvocationContext.getCurrent().setTransaction( currentTx );
+ cache.getInvocationContext().setTransaction( currentTx );
}
}
@@ -676,7 +676,7 @@
protected void runCommitPhase(GlobalTransaction gtx, Transaction tx, List modifications, boolean onePhaseCommit)
{
// set the hasMods flag in the invocation ctx. This should not be replicated, just used locally by the interceptors.
- InvocationContext.getCurrent().setTxHasMods( modifications != null && modifications.size() > 0 );
+ cache.getInvocationContext().setTxHasMods( modifications != null && modifications.size() > 0 );
try
{
MethodCall commitMethod;
@@ -735,7 +735,7 @@
//Transaction ltx = null;
try
{
- InvocationContext.getCurrent().setTxHasMods( modifications != null && modifications.size() > 0 );
+ cache.getInvocationContext().setTxHasMods( modifications != null && modifications.size() > 0 );
// JBCACHE-457
// MethodCall rollbackMethod = MethodCall(TreeCache.rollbackMethod, new Object[]{gtx, hasMods ? Boolean.TRUE : Boolean.FALSE});
MethodCall rollbackMethod = MethodCallFactory.create(MethodDeclarations.rollbackMethod, new Object[]{gtx});
@@ -927,14 +927,14 @@
Transaction localTx = createLocalTx();
txTable.put(localTx, gtx);
// attach this to the context
- InvocationContext.getCurrent().setTransaction(localTx);
+ cache.getInvocationContext().setTransaction(localTx);
if (log.isTraceEnabled()) log.trace("Created new tx for gtx " + gtx);
return localTx;
}
private void setInvocationContext(Transaction tx, GlobalTransaction gtx)
{
- InvocationContext ctx = InvocationContext.getCurrent();
+ InvocationContext ctx = cache.getInvocationContext();
ctx.setTransaction( tx );
ctx.setGlobalTransaction( gtx );
}
@@ -944,7 +944,7 @@
if (removeTxs) setInvocationContext(null, null);
// only scrub options; not tx and gtx
- InvocationContext.getCurrent().setOptionOverrides(null);
+ cache.getInvocationContext().setOptionOverrides(null);
}
// ------------------------------------------------------------------------
@@ -994,7 +994,7 @@
if ((entry = txTable.get(gtx)) != null)
{
modifications = entry.getModifications();
- InvocationContext.getCurrent().setOptionOverrides(entry.getOption());
+ cache.getInvocationContext().setOptionOverrides(entry.getOption());
}
transactions.remove(tx);
@@ -1058,7 +1058,7 @@
}
// set any transaction wide options as current for this thread.
- InvocationContext.getCurrent().setOptionOverrides( entry.getOption() );
+ cache.getInvocationContext().setOptionOverrides( entry.getOption() );
try
{
@@ -1101,7 +1101,7 @@
public void afterCompletion(int status)
{
- InvocationContext.getCurrent().setLocalRollbackOnly( localRollbackOnly );
+ cache.getInvocationContext().setLocalRollbackOnly( localRollbackOnly );
super.afterCompletion(status);
}
1.13 +5 -3 JBossCache/src/org/jboss/cache/interceptors/UnlockInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: UnlockInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/UnlockInterceptor.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- UnlockInterceptor.java 19 Jul 2006 21:34:43 -0000 1.12
+++ UnlockInterceptor.java 18 Aug 2006 15:40:39 -0000 1.13
@@ -15,14 +15,16 @@
* LockTable. This is a no-op if a transaction is used.
*
* @author Bela Ban
- * @version $Id: UnlockInterceptor.java,v 1.12 2006/07/19 21:34:43 msurtani Exp $
+ * @version $Id: UnlockInterceptor.java,v 1.13 2006/08/18 15:40:39 msurtani Exp $
*/
public class UnlockInterceptor extends Interceptor {
Map lock_table = null;
boolean trace = log.isTraceEnabled();
- public void setCache(CacheSPI cache) {
+ public void setCache(CacheSPI cache)
+ {
+ super.setCache(cache);
lock_table = cache.getLockTable();
}
@@ -32,7 +34,7 @@
}
finally
{
- InvocationContext ctx = InvocationContext.getCurrent();
+ InvocationContext ctx = cache.getInvocationContext();
if (ctx.getOptionOverrides() == null || !ctx.getOptionOverrides().isSuppressLocking())
{
Transaction tx = ctx.getTransaction();
More information about the jboss-cvs-commits
mailing list