[jboss-cvs] JBossCache/src/org/jboss/cache/interceptors ...
Manik Surtani
msurtani at jboss.com
Fri Aug 25 10:10:08 EDT 2006
User: msurtani
Date: 06/08/25 10:10:08
Modified: src/org/jboss/cache/interceptors
ActivationInterceptor.java BaseRpcInterceptor.java
CacheLoaderInterceptor.java
CacheMgmtInterceptor.java
CacheStoreInterceptor.java CallInterceptor.java
CreateIfNotExistsInterceptor.java
DataGravitatorInterceptor.java
EvictionInterceptor.java Interceptor.java
InvalidationInterceptor.java
OptimisticCreateIfNotExistsInterceptor.java
OptimisticLockingInterceptor.java
OptimisticNodeInterceptor.java
OptimisticReplicationInterceptor.java
OptimisticValidatorInterceptor.java
PassivationInterceptor.java
PessimisticLockInterceptor.java
ReplicationInterceptor.java TxInterceptor.java
UnlockInterceptor.java
Log:
More work on JBCACHE-734
Revision Changes Path
1.33 +7 -9 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.32
retrieving revision 1.33
diff -u -b -r1.32 -r1.33
--- ActivationInterceptor.java 22 Aug 2006 11:38:54 -0000 1.32
+++ ActivationInterceptor.java 25 Aug 2006 14:10:07 -0000 1.33
@@ -9,9 +9,8 @@
import org.jboss.cache.TransactionTable;
import org.jboss.cache.TreeCache;
import org.jboss.cache.TreeCacheProxyImpl;
-import org.jboss.cache.marshall.JBCMethodCall;
import org.jboss.cache.marshall.MethodDeclarations;
-import org.jgroups.blocks.MethodCall;
+import org.jboss.cache.marshall.MethodCall;
import javax.transaction.TransactionManager;
import java.lang.reflect.Method;
@@ -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.32 2006/08/22 11:38:54 msurtani Exp $
+ * @version $Id: ActivationInterceptor.java,v 1.33 2006/08/25 14:10:07 msurtani Exp $
*/
public class ActivationInterceptor extends CacheLoaderInterceptor implements ActivationInterceptorMBean {
@@ -53,12 +52,11 @@
* @return
* @throws Throwable
*/
- public Object invoke(MethodCall call) throws Throwable {
- JBCMethodCall m = (JBCMethodCall) call;
+ public Object invoke(MethodCall m) throws Throwable {
+
Fqn fqn=null;
- Method meth=m.getMethod();
Object[] args=m.getArgs();
- Object retval=null;
+ Object retval;
// First call the parent class to load the node
retval = super.invoke(m);
@@ -237,7 +235,7 @@
return;
List cache_loader_modifications=new ArrayList();
for(Iterator it=modifications.iterator(); it.hasNext();) {
- JBCMethodCall methodCall=(JBCMethodCall)it.next();
+ MethodCall methodCall=(MethodCall)it.next();
Method method=methodCall.getMethod();
Object[] args;
if(method == null)
1.18 +4 -5 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.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- BaseRpcInterceptor.java 18 Aug 2006 15:40:39 -0000 1.17
+++ BaseRpcInterceptor.java 25 Aug 2006 14:10:07 -0000 1.18
@@ -5,11 +5,10 @@
import org.jboss.cache.CacheSPI;
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.Address;
-import org.jgroups.blocks.MethodCall;
+import org.jboss.cache.marshall.MethodCall;
import java.util.Iterator;
import java.util.List;
@@ -58,12 +57,12 @@
}
}
- protected void replicateCall(JBCMethodCall call, boolean sync) throws Throwable
+ protected void replicateCall(MethodCall call, boolean sync) throws Throwable
{
replicateCall(null, call, sync);
}
- protected void replicateCall(List<Address> recipients, JBCMethodCall call, boolean sync) throws Throwable
+ protected void replicateCall(List<Address> recipients, MethodCall call, boolean sync) throws Throwable
{
if (log.isTraceEnabled()) log.trace("Broadcasting call " + call + " to recipient list " + recipients);
@@ -103,7 +102,7 @@
cache.getReplQueue().add(MethodCallFactory.create(MethodDeclarations.replicateMethod, new Object[]{call}));
}
- protected boolean containsModifications(JBCMethodCall m)
+ protected boolean containsModifications(MethodCall m)
{
switch (m.getMethodId())
{
1.48 +14 -17 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.47
retrieving revision 1.48
diff -u -b -r1.47 -r1.48
--- CacheLoaderInterceptor.java 22 Aug 2006 11:38:54 -0000 1.47
+++ CacheLoaderInterceptor.java 25 Aug 2006 14:10:07 -0000 1.48
@@ -7,23 +7,21 @@
import org.jboss.cache.loader.ChainingCacheLoader;
import org.jboss.cache.marshall.MethodCallFactory;
import org.jboss.cache.marshall.MethodDeclarations;
-import org.jboss.cache.marshall.JBCMethodCall;
-import org.jgroups.blocks.MethodCall;
+import org.jboss.cache.marshall.MethodCall;
-import java.lang.reflect.Method;
+import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.util.Set;
-import java.util.Collection;
-import java.util.Collections;
/**
* 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.47 2006/08/22 11:38:54 msurtani Exp $
+ * @version $Id: CacheLoaderInterceptor.java,v 1.48 2006/08/25 14:10:07 msurtani Exp $
*/
public class CacheLoaderInterceptor extends BaseCacheLoaderInterceptor implements CacheLoaderInterceptorMBean
{
@@ -81,18 +79,17 @@
* @return
* @throws Throwable
*/
- public Object invoke(MethodCall call) throws Throwable {
- JBCMethodCall m = (JBCMethodCall) call;
+ public Object invoke(MethodCall m) throws Throwable {
Fqn fqn=null; // if set, load the data
- Method meth=m.getMethod();
+
Object[] args=m.getArgs();
boolean acquireLock = false; // do we need to acquire a lock if we load this node from cloader?
- Map nodeData = null;
+
boolean initNode = false; // keep uninitialized
Object key = null;
InvocationContext ctx = cache.getInvocationContext();
TransactionEntry entry = null;
- GlobalTransaction gtx = null;
+ GlobalTransaction gtx;
if ((gtx = ctx.getGlobalTransaction()) != null)
{
@@ -265,9 +262,9 @@
}
public Map dumpStatistics() {
- Map retval=new HashMap();
- retval.put("CacheLoaderLoads", new Long(m_cacheLoads));
- retval.put("CacheLoaderMisses", new Long(m_cacheMisses));
+ Map<String, Long> retval=new HashMap<String, Long>();
+ retval.put("CacheLoaderLoads", m_cacheLoads);
+ retval.put("CacheLoaderMisses", m_cacheMisses);
return retval;
}
@@ -275,9 +272,9 @@
if (configuration.isNodeLockingOptimistic()) return;
- MethodCall meth=MethodCallFactory.create(MethodDeclarations.lockMethodLocal,
+ MethodCall m=MethodCallFactory.create(MethodDeclarations.lockMethodLocal,
new Object[]{fqn, lock_type, Boolean.valueOf(recursive)});
- super.invoke(meth);
+ super.invoke(m);
}
/**
@@ -314,7 +311,7 @@
Iterator i = entry.getCacheLoaderModifications().iterator();
while (i.hasNext())
{
- JBCMethodCall m = (JBCMethodCall)i.next();
+ MethodCall m = (MethodCall)i.next();
if (m.getMethodId() == MethodDeclarations.removeNodeMethodLocal_id
&& fqn.isChildOrEquals((Fqn)m.getArgs()[1]))
return true;
1.19 +6 -16 JBossCache/src/org/jboss/cache/interceptors/CacheMgmtInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: CacheMgmtInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/CacheMgmtInterceptor.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- CacheMgmtInterceptor.java 25 Aug 2006 11:59:02 -0000 1.18
+++ CacheMgmtInterceptor.java 25 Aug 2006 14:10:07 -0000 1.19
@@ -25,10 +25,9 @@
import org.jboss.cache.CacheListener;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
-import org.jboss.cache.marshall.JBCMethodCall;
+import org.jboss.cache.marshall.MethodCall;
import org.jboss.cache.marshall.MethodDeclarations;
import org.jgroups.View;
-import org.jgroups.blocks.MethodCall;
import javax.management.ListenerNotFoundException;
import javax.management.MBeanNotificationInfo;
@@ -37,14 +36,13 @@
import javax.management.NotificationBroadcasterSupport;
import javax.management.NotificationFilter;
import javax.management.NotificationListener;
-import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
/**
* Captures cache management statistics
* @author Jerry Gauthier
- * @version $Id: CacheMgmtInterceptor.java,v 1.18 2006/08/25 11:59:02 msurtani Exp $
+ * @version $Id: CacheMgmtInterceptor.java,v 1.19 2006/08/25 14:10:07 msurtani Exp $
*/
public class CacheMgmtInterceptor extends Interceptor implements CacheMgmtInterceptorMBean, NotificationBroadcaster
{
@@ -112,16 +110,11 @@
* @return
* @throws Throwable
*/
- public Object invoke(MethodCall call) throws Throwable
+ public Object invoke(MethodCall m) throws Throwable
{
- //Fqn fqn;
Map attributes;
- JBCMethodCall m = (JBCMethodCall) call;
- //Object key;
- //Object value;
- Method meth = m.getMethod();
Object[]args = m.getArgs();
- Object retval = null;
+ Object retval;
// if statistics not enabled, execute the method and return
@@ -413,10 +406,7 @@
if (pre)
{
Notification n;
- if (pre)
n = new Notification(NOTIF_NODE_REMOVE, this, seq(), MSG_NODE_REMOVE);
- else
- n = new Notification(NOTIF_NODE_REMOVED, this, seq(), MSG_NODE_REMOVED);
n.setUserData(new Object[]{fqn.toString(), Boolean.valueOf(pre), Boolean.valueOf(isLocal)});
m_broadcaster.sendNotification(n);
}
1.29 +12 -17 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.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- CacheStoreInterceptor.java 18 Aug 2006 15:40:39 -0000 1.28
+++ CacheStoreInterceptor.java 25 Aug 2006 14:10:07 -0000 1.29
@@ -8,9 +8,8 @@
import org.jboss.cache.TransactionEntry;
import org.jboss.cache.TransactionTable;
import org.jboss.cache.config.CacheLoaderConfig;
-import org.jboss.cache.marshall.JBCMethodCall;
import org.jboss.cache.marshall.MethodDeclarations;
-import org.jgroups.blocks.MethodCall;
+import org.jboss.cache.marshall.MethodCall;
import javax.transaction.TransactionManager;
import java.lang.reflect.Method;
@@ -25,7 +24,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.28 2006/08/18 15:40:39 msurtani Exp $
+ * @version $Id: CacheStoreInterceptor.java,v 1.29 2006/08/25 14:10:07 msurtani Exp $
*/
public class CacheStoreInterceptor extends BaseCacheLoaderInterceptor implements CacheStoreInterceptorMBean
{
@@ -48,13 +47,10 @@
* Pass the method on. When it returns, store the modification back to the store using the CacheLoader.
* In case of a transaction, register for TX completion (2PC) and at TX commit, write modifications made
* under the given TX to the CacheLoader
- * @param call
* @return
* @throws Throwable
*/
- public Object invoke(MethodCall call) throws Throwable {
-
- JBCMethodCall m = (JBCMethodCall) call;
+ public Object invoke(MethodCall m) throws Throwable {
// 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
@@ -230,13 +226,12 @@
return retval;
}
- private List getFqnsFromModificationList(List modifications)
+ private List getFqnsFromModificationList(List<MethodCall> modifications)
{
- Iterator it = modifications.iterator();
- List fqnList = new ArrayList();
- while (it.hasNext())
+ List<Fqn> fqnList = new ArrayList<Fqn>();
+
+ for (MethodCall mc : modifications)
{
- MethodCall mc = (MethodCall) it.next();
Fqn fqn = findFqn(mc.getArgs());
if (fqn != null && !fqnList.contains(fqn)) fqnList.add(fqn);
}
@@ -261,8 +256,8 @@
}
public Map dumpStatistics() {
- Map retval=new HashMap();
- retval.put("CacheLoaderStores", new Long(m_cacheStores));
+ Map<String, Long> retval=new HashMap<String, Long>();
+ retval.put("CacheLoaderStores", m_cacheStores);
return retval;
}
@@ -279,7 +274,7 @@
return;
List cache_loader_modifications=new ArrayList();
for(Iterator it=modifications.iterator(); it.hasNext();) {
- JBCMethodCall methodCall=(JBCMethodCall) it.next();
+ MethodCall methodCall=(MethodCall) it.next();
Modification mod=convertMethodCallToModification(methodCall);
cache_loader_modifications.add(mod);
if (configuration.isUseInterceptorMbeans() && getStatisticsEnabled()) {
@@ -298,7 +293,7 @@
}
}
- protected Modification convertMethodCallToModification(JBCMethodCall methodCall) throws Exception {
+ protected Modification convertMethodCallToModification(MethodCall methodCall) throws Exception {
Method method=methodCall.getMethod();
Object[] args;
if(method == null)
1.15 +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.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- CallInterceptor.java 25 Aug 2006 12:41:35 -0000 1.14
+++ CallInterceptor.java 25 Aug 2006 14:10:07 -0000 1.15
@@ -5,8 +5,8 @@
import org.jboss.cache.InvocationContext;
import org.jboss.cache.TreeCache;
import org.jboss.cache.config.Option;
-import org.jboss.cache.marshall.JBCMethodCall;
import org.jboss.cache.marshall.MethodDeclarations;
+import org.jboss.cache.marshall.MethodCall;
import javax.transaction.Transaction;
@@ -19,7 +19,7 @@
* this interceptor unless it is a call the OptimisticNodeInterceptor knows nothing about.
*
* @author Bela Ban
- * @version $Id: CallInterceptor.java,v 1.14 2006/08/25 12:41:35 msurtani Exp $
+ * @version $Id: CallInterceptor.java,v 1.15 2006/08/25 14:10:07 msurtani Exp $
*/
public class CallInterceptor extends Interceptor
{
@@ -35,7 +35,7 @@
treeCache = c;
}
- public Object invoke(JBCMethodCall m) throws Throwable
+ public Object invoke(MethodCall m) throws Throwable
{
Object retval = null;
1.18 +3 -5 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.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- CreateIfNotExistsInterceptor.java 25 Aug 2006 12:41:35 -0000 1.17
+++ CreateIfNotExistsInterceptor.java 25 Aug 2006 14:10:07 -0000 1.18
@@ -6,10 +6,9 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.GlobalTransaction;
import org.jboss.cache.Node;
-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.jboss.cache.marshall.MethodCall;
import java.util.ArrayList;
import java.util.Iterator;
@@ -18,7 +17,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.17 2006/08/25 12:41:35 msurtani Exp $
+ * @version $Id: CreateIfNotExistsInterceptor.java,v 1.18 2006/08/25 14:10:07 msurtani Exp $
* @deprecated This code is not used anymore and will be removed in a future release
*/
public class CreateIfNotExistsInterceptor extends Interceptor {
@@ -108,8 +107,7 @@
* @return
* @throws Throwable
*/
- public Object invoke(MethodCall call) throws Throwable {
- JBCMethodCall m = (JBCMethodCall) call;
+ public Object invoke(MethodCall m) throws Throwable {
Fqn fqn;
boolean isPut=MethodDeclarations.isPutMethod(m.getMethodId()),
isRemove=m.getMethodId() == MethodDeclarations.removeNodeMethodLocal_id,
1.23 +9 -12 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.22
retrieving revision 1.23
diff -u -b -r1.22 -r1.23
--- DataGravitatorInterceptor.java 25 Aug 2006 12:41:35 -0000 1.22
+++ DataGravitatorInterceptor.java 25 Aug 2006 14:10:07 -0000 1.23
@@ -22,13 +22,12 @@
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Option;
import org.jboss.cache.loader.NodeData;
-import org.jboss.cache.marshall.JBCMethodCall;
import org.jboss.cache.marshall.MethodCallFactory;
import org.jboss.cache.marshall.MethodDeclarations;
import org.jboss.invocation.MarshalledValueInputStream;
import org.jgroups.Address;
import org.jgroups.blocks.GroupRequest;
-import org.jgroups.blocks.MethodCall;
+import org.jboss.cache.marshall.MethodCall;
import java.io.ByteArrayInputStream;
import java.util.ArrayList;
@@ -63,9 +62,8 @@
syncCommunications = configuration.getCacheMode() == Configuration.CacheMode.REPL_SYNC || configuration.getCacheMode() == Configuration.CacheMode.INVALIDATION_SYNC;
}
- public Object invoke(MethodCall call) throws Throwable
+ public Object invoke(MethodCall m) throws Throwable
{
- JBCMethodCall m = (JBCMethodCall) call;
// if (isGravitationEnabled(cache.getInvocationContext()))
// {
// Option opt = cache.getInvocationContext().getOptionOverrides();
@@ -89,7 +87,7 @@
{
if (!cache.hasChild(fqn))
{
- BackupData data = null;
+ BackupData data;
// perform a data gravitation
if (localBackupExists(fqn))
@@ -182,7 +180,7 @@
if (log.isTraceEnabled()) log.trace("Broadcasting prepare for cleanup ops " + cleanup);
if (cleanup != null)
{
- JBCMethodCall prepare;
+ MethodCall prepare;
List mods = new ArrayList(1);
mods.add(cleanup);
if (configuration.isNodeLockingOptimistic())
@@ -280,7 +278,7 @@
// backupDataCleanup = MethodCallFactory.create(MethodDeclarations.evictNodeMethodLocal, new Object[]{backup.backupFqn});
// }
- JBCMethodCall cleanup = MethodCallFactory.create(MethodDeclarations.dataGravitationCleanupMethod, new Object[]{cache.getInvocationContext().getGlobalTransaction(), backup.primaryFqn, backup.backupFqn});
+ MethodCall cleanup = MethodCallFactory.create(MethodDeclarations.dataGravitationCleanupMethod, new Object[]{cache.getInvocationContext().getGlobalTransaction(), backup.primaryFqn, backup.backupFqn});
if (log.isTraceEnabled()) log.trace("Performing cleanup on [" +backup.primaryFqn+ "]");
@@ -362,7 +360,6 @@
private void createNode(boolean localOnly, List nodeData) throws CacheException
{
Iterator nodes = nodeData.iterator();
- GlobalTransaction gtx = cache.getInvocationContext().getGlobalTransaction();
while (nodes.hasNext())
{
@@ -371,7 +368,7 @@
{
if (!cache.hasChild(data.getFqn()))
{
- createNodes(gtx, data.getFqn(), data.getAttributes());
+ createNodes(data.getFqn(), data.getAttributes());
}
}
else
@@ -381,7 +378,7 @@
}
}
- private void createNodes(GlobalTransaction gtx, Fqn fqn, Map data) throws CacheException
+ private void createNodes(Fqn fqn, Map data) throws CacheException
{
int treeNodeSize;
if ((treeNodeSize=fqn.size()) == 0) return;
@@ -398,9 +395,9 @@
if (i == treeNodeSize - 1)
{
// set data
- // TODO: This needs to bypass the interceptor stack. Old code used an _put()
- //cache._put(gtx, fqn, data, true);
+ cache.getInvocationContext().getOptionOverrides().setBypassInterceptorChain(true);
cache.put(fqn, data);
+ cache.getInvocationContext().getOptionOverrides().setBypassInterceptorChain(false);
}
n = child_node;
}
1.6 +13 -13 JBossCache/src/org/jboss/cache/interceptors/EvictionInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: EvictionInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/EvictionInterceptor.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- EvictionInterceptor.java 25 Aug 2006 11:59:02 -0000 1.5
+++ EvictionInterceptor.java 25 Aug 2006 14:10:07 -0000 1.6
@@ -15,7 +15,7 @@
import org.jboss.cache.eviction.Region;
import org.jboss.cache.eviction.RegionManager;
import org.jboss.cache.marshall.MethodDeclarations;
-import org.jgroups.blocks.MethodCall;
+import org.jboss.cache.marshall.MethodCall;
import java.util.HashMap;
import java.util.Map;
@@ -26,39 +26,39 @@
* This interceptor is used to handle eviction events.
*
* @author Daniel Huang
- * @version $Revision: 1.5 $
+ * @version $Revision: 1.6 $
*/
public class EvictionInterceptor extends Interceptor
{
private static final Log log = LogFactory.getLog(EvictionInterceptor.class);
protected RegionManager regionManager;
- protected Map evictionMethodHandlers = new HashMap();
+ protected Map<Integer, EvictionMethodHandler> evictionMethodHandlers = new HashMap<Integer, EvictionMethodHandler>();
public EvictionInterceptor()
{
EvictionMethodHandler handler = new GetNodeEvictionMethodHandler();
- evictionMethodHandlers.put(MethodDeclarations.getNodeMethodLocal, handler);
- evictionMethodHandlers.put(MethodDeclarations.getDataMapMethodLocal, handler);
+ evictionMethodHandlers.put(MethodDeclarations.getNodeMethodLocal_id, handler);
+ evictionMethodHandlers.put(MethodDeclarations.getDataMapMethodLocal_id, handler);
handler = new GetKeyEvictionMethodHandler();
- evictionMethodHandlers.put(MethodDeclarations.getKeyValueMethodLocal, handler);
+ evictionMethodHandlers.put(MethodDeclarations.getKeyValueMethodLocal_id, handler);
handler = new RemoveNodeEvictionMethodHandler();
- evictionMethodHandlers.put(MethodDeclarations.removeNodeMethodLocal, handler);
- evictionMethodHandlers.put(MethodDeclarations.removeDataMethodLocal, handler);
+ evictionMethodHandlers.put(MethodDeclarations.removeNodeMethodLocal_id, handler);
+ evictionMethodHandlers.put(MethodDeclarations.removeDataMethodLocal_id, handler);
handler = new RemoveKeyEvictionMethodHandler();
- evictionMethodHandlers.put(MethodDeclarations.removeKeyMethodLocal, handler);
+ evictionMethodHandlers.put(MethodDeclarations.removeKeyMethodLocal_id, handler);
handler = new PutDataEvictionMethodHandler();
- evictionMethodHandlers.put(MethodDeclarations.putDataMethodLocal, handler);
+ evictionMethodHandlers.put(MethodDeclarations.putDataMethodLocal_id, handler);
handler = new PutDataEraseEvictionMethodHandler();
- evictionMethodHandlers.put(MethodDeclarations.putDataEraseMethodLocal, handler);
+ evictionMethodHandlers.put(MethodDeclarations.putDataEraseMethodLocal_id, handler);
handler = new PutKeyEvictionMethodHandler();
- evictionMethodHandlers.put(MethodDeclarations.putKeyValMethodLocal, handler);
+ evictionMethodHandlers.put(MethodDeclarations.putKeyValMethodLocal_id, handler);
}
/**
@@ -122,7 +122,7 @@
protected EvictedEventNode extractEvent(MethodCall m, Object retVal)
{
- EvictionMethodHandler handler = (EvictionMethodHandler) this.evictionMethodHandlers.get(m.getMethod());
+ EvictionMethodHandler handler = this.evictionMethodHandlers.get(m.getMethodId());
if (handler == null)
{
return null;
1.22 +5 -6 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.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- Interceptor.java 25 Aug 2006 12:41:35 -0000 1.21
+++ Interceptor.java 25 Aug 2006 14:10:07 -0000 1.22
@@ -25,9 +25,8 @@
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.config.Configuration;
-import org.jboss.cache.marshall.JBCMethodCall;
import org.jboss.cache.marshall.MethodDeclarations;
-import org.jgroups.blocks.MethodCall;
+import org.jboss.cache.marshall.MethodCall;
import javax.transaction.Status;
import javax.transaction.SystemException;
@@ -39,7 +38,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.21 2006/08/25 12:41:35 msurtani Exp $
+ * @version $Id: Interceptor.java,v 1.22 2006/08/25 14:10:07 msurtani Exp $
*/
public abstract class Interceptor implements InterceptorMBean {
protected Interceptor next=null, last = null;
@@ -146,7 +145,7 @@
* This only works for prepare() and optimisticPrepare() method calls.
* @param m
*/
- protected boolean isOnePhaseCommitPrepareMehod(JBCMethodCall m)
+ protected boolean isOnePhaseCommitPrepareMehod(MethodCall m)
{
switch (m.getMethodId())
{
1.24 +23 -16 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.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- InvalidationInterceptor.java 25 Aug 2006 12:41:35 -0000 1.23
+++ InvalidationInterceptor.java 25 Aug 2006 14:10:07 -0000 1.24
@@ -6,19 +6,28 @@
*/
package org.jboss.cache.interceptors;
-import org.jboss.cache.*;
-import org.jboss.cache.config.Option;
+import org.jboss.cache.CacheSPI;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.GlobalTransaction;
+import org.jboss.cache.InvocationContext;
+import org.jboss.cache.OptimisticTransactionEntry;
+import org.jboss.cache.TransactionEntry;
+import org.jboss.cache.TransactionTable;
import org.jboss.cache.config.Configuration;
+import org.jboss.cache.config.Option;
import org.jboss.cache.marshall.MethodCallFactory;
import org.jboss.cache.marshall.MethodDeclarations;
-import org.jboss.cache.marshall.JBCMethodCall;
import org.jboss.cache.optimistic.TransactionWorkspace;
-import org.jgroups.blocks.MethodCall;
+import org.jboss.cache.marshall.MethodCall;
import javax.transaction.SystemException;
import javax.transaction.Transaction;
-import java.lang.reflect.Method;
-import java.util.*;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
/**
* This interceptor acts as a replacement to the replication interceptor when
@@ -43,9 +52,8 @@
txTable=cache.getTransactionTable();
}
- public Object invoke(MethodCall call) throws Throwable
+ public Object invoke(MethodCall m) throws Throwable
{
- JBCMethodCall m = (JBCMethodCall) call;
InvocationContext ctx = cache.getInvocationContext();
Option optionOverride = ctx.getOptionOverrides();
if (optionOverride != null && optionOverride.isCacheModeLocal() && ctx.getTransaction() == null)
@@ -56,7 +64,6 @@
Transaction tx = ctx.getTransaction();
Object retval = super.invoke(m);
- Method meth = m.getMethod();
if (log.isTraceEnabled()) log.trace("(" + cache.getLocalAddress() + ") method call " + m );
@@ -91,7 +98,7 @@
GlobalTransaction gtx = ctx.getGlobalTransaction();
TransactionEntry entry = txTable.get(gtx);
if (entry == null) throw new IllegalStateException("cannot find transaction entry for " + gtx);
- List<JBCMethodCall> modifications = new LinkedList<JBCMethodCall>(entry.getModifications());
+ List<MethodCall> modifications = new LinkedList<MethodCall>(entry.getModifications());
if (modifications.size() > 0)
{
@@ -134,8 +141,8 @@
public Map dumpStatistics()
{
- Map retval=new HashMap();
- retval.put("Invalidations", new Long(m_invalidations));
+ Map<String, Long> retval=new HashMap<String, Long>();
+ retval.put("Invalidations", m_invalidations);
return retval;
}
@@ -146,7 +153,7 @@
m_invalidations++;
// only propagate version details if we're using explicit versioning.
- JBCMethodCall call = workspace != null && !workspace.isVersioningImplicit() ?
+ MethodCall call = workspace != null && !workspace.isVersioningImplicit() ?
MethodCallFactory.create(MethodDeclarations.evictVersionedNodeMethodLocal, new Object[]{fqn, workspace.getNode(fqn).getVersion()}) :
MethodCallFactory.create(MethodDeclarations.evictNodeMethodLocal, new Object[]{fqn});
@@ -155,7 +162,7 @@
replicateCall(call, configuration.getCacheMode() == Configuration.CacheMode.INVALIDATION_SYNC);
}
- protected void invalidateModifications(List<JBCMethodCall> modifications, TransactionWorkspace workspace) throws Throwable
+ protected void invalidateModifications(List<MethodCall> modifications, TransactionWorkspace workspace) throws Throwable
{
// optimise the calls list here.
Set<Fqn> modifiedFqns = optimisedIterator(modifications);
@@ -181,10 +188,10 @@
* @param list
* @return Iterator containing a unique set of Fqns of crud methods in this tx
*/
- protected Set<Fqn> optimisedIterator(List<JBCMethodCall> list)
+ protected Set<Fqn> optimisedIterator(List<MethodCall> list)
{
Set<Fqn> fqns = new HashSet<Fqn>();
- for (JBCMethodCall mc : list)
+ for (MethodCall mc : list)
{
if (MethodDeclarations.isCrudMethod(mc.getMethodId()))
{
1.27 +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.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- OptimisticCreateIfNotExistsInterceptor.java 25 Aug 2006 12:41:35 -0000 1.26
+++ OptimisticCreateIfNotExistsInterceptor.java 25 Aug 2006 14:10:07 -0000 1.27
@@ -8,11 +8,11 @@
import org.jboss.cache.*;
import org.jboss.cache.factories.NodeFactory;
-import org.jboss.cache.marshall.JBCMethodCall;
import org.jboss.cache.marshall.MethodDeclarations;
import org.jboss.cache.optimistic.DataVersion;
import org.jboss.cache.optimistic.TransactionWorkspace;
import org.jboss.cache.optimistic.WorkspaceNode;
+import org.jboss.cache.marshall.MethodCall;
import java.util.ArrayList;
import java.util.Iterator;
@@ -26,7 +26,7 @@
*/
public class OptimisticCreateIfNotExistsInterceptor extends OptimisticInterceptor
{
- public Object invoke(JBCMethodCall m) throws Throwable
+ public Object invoke(MethodCall m) throws Throwable
{
//should this be just put methods
@@ -82,7 +82,7 @@
throw new CacheException("Unable to map global transaction " + gtx + " to transaction entry");
}
- WorkspaceNode workspaceNode, childWorkspaceNode = null;
+ WorkspaceNode workspaceNode, childWorkspaceNode;
Object childName;
List nodesCreated = new ArrayList();
1.21 +3 -5 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.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- OptimisticLockingInterceptor.java 21 Aug 2006 18:00:49 -0000 1.20
+++ OptimisticLockingInterceptor.java 25 Aug 2006 14:10:07 -0000 1.21
@@ -12,11 +12,10 @@
import org.jboss.cache.GlobalTransaction;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.TransactionEntry;
-import org.jboss.cache.marshall.JBCMethodCall;
import org.jboss.cache.marshall.MethodDeclarations;
import org.jboss.cache.optimistic.TransactionWorkspace;
import org.jboss.cache.optimistic.WorkspaceNode;
-import org.jgroups.blocks.MethodCall;
+import org.jboss.cache.marshall.MethodCall;
import java.lang.reflect.Method;
import java.util.Collection;
@@ -38,9 +37,8 @@
lockAcquisitionTimeout = cache.getConfiguration().getLockAcquisitionTimeout();
}
- public Object invoke(MethodCall call) throws Throwable
+ public Object invoke(MethodCall m) throws Throwable
{
- JBCMethodCall m = (JBCMethodCall) call;
InvocationContext ctx = cache.getInvocationContext();
Object retval = null;
Method meth = m.getMethod();
1.26 +3 -5 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.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- OptimisticNodeInterceptor.java 25 Aug 2006 12:41:35 -0000 1.25
+++ OptimisticNodeInterceptor.java 25 Aug 2006 14:10:07 -0000 1.26
@@ -15,12 +15,11 @@
import org.jboss.cache.TreeNode;
import org.jboss.cache.config.Option;
import org.jboss.cache.factories.NodeFactory;
-import org.jboss.cache.marshall.JBCMethodCall;
import org.jboss.cache.marshall.MethodDeclarations;
import org.jboss.cache.optimistic.DataVersion;
import org.jboss.cache.optimistic.TransactionWorkspace;
import org.jboss.cache.optimistic.WorkspaceNode;
-import org.jgroups.blocks.MethodCall;
+import org.jboss.cache.marshall.MethodCall;
import javax.transaction.Transaction;
import java.util.Iterator;
@@ -35,9 +34,8 @@
*/
public class OptimisticNodeInterceptor extends OptimisticInterceptor
{
- public Object invoke(MethodCall call) throws Throwable
+ public Object invoke(MethodCall m) throws Throwable
{
- JBCMethodCall m = (JBCMethodCall) call;
InvocationContext ctx = cache.getInvocationContext();
Transaction tx = ctx.getTransaction();
Object[] args = m.getArgs();
1.25 +6 -8 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.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- OptimisticReplicationInterceptor.java 18 Aug 2006 15:40:39 -0000 1.24
+++ OptimisticReplicationInterceptor.java 25 Aug 2006 14:10:07 -0000 1.25
@@ -10,12 +10,11 @@
import org.jboss.cache.CacheException;
import org.jboss.cache.GlobalTransaction;
import org.jboss.cache.InvocationContext;
-import org.jboss.cache.config.Option;
import org.jboss.cache.config.Configuration;
-import org.jboss.cache.marshall.JBCMethodCall;
+import org.jboss.cache.config.Option;
import org.jboss.cache.marshall.MethodCallFactory;
import org.jboss.cache.marshall.MethodDeclarations;
-import org.jgroups.blocks.MethodCall;
+import org.jboss.cache.marshall.MethodCall;
import java.util.List;
import java.util.Map;
@@ -33,9 +32,8 @@
// local prepare failures
private Map broadcastTxs = new ConcurrentHashMap();
- public Object invoke(MethodCall call) throws Throwable
+ public Object invoke(MethodCall m) throws Throwable
{
- JBCMethodCall m = (JBCMethodCall) call;
InvocationContext ctx = cache.getInvocationContext();
Option optionOverride = ctx.getOptionOverrides();
if (optionOverride != null && optionOverride.isCacheModeLocal() && ctx.getTransaction() == null)
@@ -138,7 +136,7 @@
return retval;
}
- protected Object broadcastPrepare(JBCMethodCall methodCall, GlobalTransaction gtx) throws Throwable
+ protected Object broadcastPrepare(MethodCall methodCall, GlobalTransaction gtx) throws Throwable
{
boolean remoteCallSync = configuration.getCacheMode() == Configuration.CacheMode.REPL_SYNC;
@@ -180,7 +178,7 @@
try
{
broadcastTxs.remove(gtx);
- JBCMethodCall commit_method = MethodCallFactory.create(MethodDeclarations.commitMethod,
+ MethodCall commit_method = MethodCallFactory.create(MethodDeclarations.commitMethod,
new Object[]{gtx});
log.debug("running remote commit for " + gtx
@@ -210,7 +208,7 @@
try
{
broadcastTxs.remove(gtx);
- JBCMethodCall rollback_method = MethodCallFactory.create(MethodDeclarations.rollbackMethod, new Object[]{gtx});
+ MethodCall rollback_method = MethodCallFactory.create(MethodDeclarations.rollbackMethod, new Object[]{gtx});
log.debug("running remote rollback for " + gtx
+ " and coord=" + cache.getLocalAddress());
1.32 +4 -8 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.31
retrieving revision 1.32
diff -u -b -r1.31 -r1.32
--- OptimisticValidatorInterceptor.java 24 Aug 2006 16:30:10 -0000 1.31
+++ OptimisticValidatorInterceptor.java 25 Aug 2006 14:10:07 -0000 1.32
@@ -13,15 +13,14 @@
import org.jboss.cache.InvocationContext;
import org.jboss.cache.OptimisticTreeNode;
import org.jboss.cache.TreeCacheProxyImpl;
-import org.jboss.cache.marshall.JBCMethodCall;
+import org.jboss.cache.marshall.MethodCall;
import org.jboss.cache.marshall.MethodDeclarations;
import org.jboss.cache.optimistic.DefaultDataVersion;
import org.jboss.cache.optimistic.TransactionWorkspace;
import org.jboss.cache.optimistic.WorkspaceNode;
-import org.jgroups.blocks.MethodCall;
+import org.jboss.cache.marshall.MethodCall;
import javax.transaction.Transaction;
-import java.lang.reflect.Method;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
@@ -46,14 +45,12 @@
*/
public class OptimisticValidatorInterceptor extends OptimisticInterceptor
{
- public Object invoke(MethodCall call) throws Throwable
+ public Object invoke(MethodCall m) throws Throwable
{
- JBCMethodCall m = (JBCMethodCall) call;
InvocationContext ctx = cache.getInvocationContext();
Transaction tx = ctx.getTransaction();
GlobalTransaction gtx = ctx.getGlobalTransaction();
Object retval = null;
- Method meth = m.getMethod();
if (tx == null)
throw new CacheException("Not in a transaction");
@@ -96,7 +93,6 @@
// should be an ordered list - get the set of nodes
Collection nodes = workspace.getNodes().values();
- boolean validated;
//we have all locks here so lets try and validate
log.debug("validating nodes");
simpleValidate(nodes);
@@ -116,7 +112,7 @@
if (trace) log.trace("validating version for node " + fqn);
// TODO: MANIK an UGLY UGLY hack. Fix this
- OptimisticTreeNode realNode = null;
+ OptimisticTreeNode realNode;
if (fqn.isRoot())
{
realNode = (OptimisticTreeNode) ((TreeCacheProxyImpl) cache).currentNode;
1.26 +5 -8 JBossCache/src/org/jboss/cache/interceptors/PassivationInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: PassivationInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/PassivationInterceptor.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- PassivationInterceptor.java 22 Aug 2006 11:38:54 -0000 1.25
+++ PassivationInterceptor.java 25 Aug 2006 14:10:07 -0000 1.26
@@ -6,9 +6,8 @@
import org.jboss.cache.Node;
import org.jboss.cache.TreeCache;
import org.jboss.cache.loader.CacheLoader;
-import org.jboss.cache.marshall.JBCMethodCall;
+import org.jboss.cache.marshall.MethodCall;
import org.jboss.cache.marshall.MethodDeclarations;
-import org.jgroups.blocks.MethodCall;
import java.util.HashMap;
import java.util.Map;
@@ -18,7 +17,7 @@
* CacheLoader, either before each method call (no TXs), or at TX commit.
*
* @author <a href="mailto:{hmesha at novell.com}">{Hany Mesha}</a>
- * @version $Id: PassivationInterceptor.java,v 1.25 2006/08/22 11:38:54 msurtani Exp $
+ * @version $Id: PassivationInterceptor.java,v 1.26 2006/08/25 14:10:07 msurtani Exp $
*/
public class PassivationInterceptor extends Interceptor implements PassivationInterceptorMBean {
@@ -36,12 +35,10 @@
* be passivated and stores the evicted node and its attributes back to the
* store using the CacheLoader.
*
- * @param call
* @return
* @throws Throwable
*/
- public Object invoke(MethodCall call) throws Throwable {
- JBCMethodCall m = (JBCMethodCall) call;
+ public Object invoke(MethodCall m) throws Throwable {
Fqn fqn;
Object[] args=m.getArgs();
@@ -80,8 +77,8 @@
}
public Map dumpStatistics() {
- Map retval=new HashMap();
- retval.put("Passivations", new Long(m_passivations.get()));
+ Map<String, Long> retval=new HashMap<String, Long>();
+ retval.put("Passivations", m_passivations.get());
return retval;
}
1.28 +4 -6 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.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- PessimisticLockInterceptor.java 25 Aug 2006 11:59:02 -0000 1.27
+++ PessimisticLockInterceptor.java 25 Aug 2006 14:10:07 -0000 1.28
@@ -19,9 +19,8 @@
import org.jboss.cache.lock.IsolationLevel;
import org.jboss.cache.lock.LockingException;
import org.jboss.cache.lock.TimeoutException;
-import org.jboss.cache.marshall.JBCMethodCall;
import org.jboss.cache.marshall.MethodDeclarations;
-import org.jgroups.blocks.MethodCall;
+import org.jboss.cache.marshall.MethodCall;
import javax.transaction.Transaction;
import java.util.Collections;
@@ -37,7 +36,7 @@
* current method and unlock when the method returns.
*
* @author Bela Ban
- * @version $Id: PessimisticLockInterceptor.java,v 1.27 2006/08/25 11:59:02 msurtani Exp $
+ * @version $Id: PessimisticLockInterceptor.java,v 1.28 2006/08/25 14:10:07 msurtani Exp $
*/
public class PessimisticLockInterceptor extends Interceptor {
TransactionTable tx_table=null;
@@ -57,8 +56,7 @@
- public Object invoke(MethodCall call) throws Throwable {
- JBCMethodCall m = (JBCMethodCall) call;
+ public Object invoke(MethodCall m) throws Throwable {
Fqn fqn=null;
DataNode.LockType lock_type=DataNode.LockType.NONE;
Object[] args=m.getArgs();
@@ -191,7 +189,7 @@
Thread currentThread = Thread.currentThread();
Object owner = (gtx != null) ? (Object)gtx : currentThread;
int treeNodeSize;
- boolean acquired=false;
+ boolean acquired;
if (log.isTraceEnabled()) log.trace("Attempting to lock node " + fqn + " for owner " + owner);
1.38 +6 -12 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.37
retrieving revision 1.38
diff -u -b -r1.37 -r1.38
--- ReplicationInterceptor.java 25 Aug 2006 12:41:35 -0000 1.37
+++ ReplicationInterceptor.java 25 Aug 2006 14:10:07 -0000 1.38
@@ -4,11 +4,8 @@
import org.jboss.cache.InvocationContext;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Option;
-import org.jboss.cache.marshall.JBCMethodCall;
import org.jboss.cache.marshall.MethodDeclarations;
-import org.jgroups.blocks.MethodCall;
-
-import java.lang.reflect.Method;
+import org.jboss.cache.marshall.MethodCall;
/**
* Takes care of replicating modifications to other nodes in a cluster. Also
@@ -16,14 +13,13 @@
* 'side-ways' (see docs/design/Refactoring.txt).
*
* @author Bela Ban
- * @version $Id: ReplicationInterceptor.java,v 1.37 2006/08/25 12:41:35 msurtani Exp $
+ * @version $Id: ReplicationInterceptor.java,v 1.38 2006/08/25 14:10:07 msurtani Exp $
*/
public class ReplicationInterceptor extends BaseRpcInterceptor
{
- public Object invoke(MethodCall call) throws Throwable
+ public Object invoke(MethodCall m) throws Throwable
{
- JBCMethodCall m = (JBCMethodCall) call;
InvocationContext ctx = cache.getInvocationContext();
GlobalTransaction gtx = ctx.getGlobalTransaction();
@@ -41,8 +37,6 @@
return isLocalCommitOrRollback ? super.invoke(m) : o;
}
- Method method = m.getMethod();
-
// could be potentially TRANSACTIONAL. If so, we register for transaction completion callbacks (if we
// have not yet done so
if (ctx.getTransaction() != null)
@@ -91,7 +85,7 @@
return o;
}
- void handleReplicatedMethod(JBCMethodCall m, Configuration.CacheMode mode) throws Throwable
+ void handleReplicatedMethod(MethodCall m, Configuration.CacheMode mode) throws Throwable
{
if (log.isTraceEnabled())
{
@@ -127,7 +121,7 @@
*
* @throws Exception
*/
- protected void runPreparePhase(JBCMethodCall prepareMethod, GlobalTransaction gtx) throws Throwable
+ protected void runPreparePhase(MethodCall prepareMethod, GlobalTransaction gtx) throws Throwable
{
boolean async = configuration.getCacheMode() == Configuration.CacheMode.REPL_ASYNC;
if (log.isTraceEnabled())
1.57 +5 -7 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.56
retrieving revision 1.57
diff -u -b -r1.56 -r1.57
--- TxInterceptor.java 25 Aug 2006 12:41:35 -0000 1.56
+++ TxInterceptor.java 25 Aug 2006 14:10:07 -0000 1.57
@@ -18,11 +18,10 @@
import org.jboss.cache.TreeCacheProxyImpl;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Option;
-import org.jboss.cache.marshall.JBCMethodCall;
import org.jboss.cache.marshall.MethodCallFactory;
import org.jboss.cache.marshall.MethodDeclarations;
import org.jgroups.Address;
-import org.jgroups.blocks.MethodCall;
+import org.jboss.cache.marshall.MethodCall;
import javax.transaction.Status;
import javax.transaction.Synchronization;
@@ -73,9 +72,8 @@
txTable = cache.getTransactionTable();
}
- public Object invoke(MethodCall call) throws Throwable
+ public Object invoke(MethodCall m) throws Throwable
{
- JBCMethodCall m = (JBCMethodCall) call;
if (log.isTraceEnabled())
{
log.trace("("+cache.getLocalAddress()+") call on method [" + m + "]");
@@ -242,7 +240,7 @@
}
}
- private Object handleRemotePrepare(JBCMethodCall m, GlobalTransaction gtx) throws Throwable
+ private Object handleRemotePrepare(MethodCall m, GlobalTransaction gtx) throws Throwable
{
List modifications = (List) m.getArgs()[1];
boolean onePhase = ((Boolean) m.getArgs()[configuration.isNodeLockingOptimistic() ? 4 : 3]).booleanValue();
@@ -428,7 +426,7 @@
return retval;
}
- private Object handlePessimisticPrepare(JBCMethodCall m, GlobalTransaction gtx, List modifications, boolean commit, Transaction ltx) throws Exception
+ private Object handlePessimisticPrepare(MethodCall m, GlobalTransaction gtx, List modifications, boolean commit, Transaction ltx) throws Exception
{
boolean success = true;
Object retval;
@@ -546,7 +544,7 @@
* @return
* @throws Throwable
*/
- private Object handleRemoteCommitRollback(JBCMethodCall m, GlobalTransaction gtx) throws Throwable
+ private Object handleRemoteCommitRollback(MethodCall m, GlobalTransaction gtx) throws Throwable
{
Transaction ltx = null;
try
1.14 +2 -2 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.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- UnlockInterceptor.java 18 Aug 2006 15:40:39 -0000 1.13
+++ UnlockInterceptor.java 25 Aug 2006 14:10:07 -0000 1.14
@@ -3,7 +3,7 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.lock.IdentityLock;
-import org.jgroups.blocks.MethodCall;
+import org.jboss.cache.marshall.MethodCall;
import javax.transaction.Transaction;
import java.util.List;
@@ -15,7 +15,7 @@
* LockTable. This is a no-op if a transaction is used.
*
* @author Bela Ban
- * @version $Id: UnlockInterceptor.java,v 1.13 2006/08/18 15:40:39 msurtani Exp $
+ * @version $Id: UnlockInterceptor.java,v 1.14 2006/08/25 14:10:07 msurtani Exp $
*/
public class UnlockInterceptor extends Interceptor {
More information about the jboss-cvs-commits
mailing list