[jboss-cvs] JBossCache/src/org/jboss/cache/interceptors ...
Manik Surtani
msurtani at jboss.com
Tue Dec 19 21:16:24 EST 2006
User: msurtani
Date: 06/12/19 21:16:24
Modified: src/org/jboss/cache/interceptors
CacheLoaderInterceptor.java
ActivationInterceptor.java
Log:
fixed passivation and eviction bugs
Revision Changes Path
1.64 +15 -14 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.63
retrieving revision 1.64
diff -u -b -r1.63 -r1.64
--- CacheLoaderInterceptor.java 29 Nov 2006 22:10:22 -0000 1.63
+++ CacheLoaderInterceptor.java 20 Dec 2006 02:16:24 -0000 1.64
@@ -6,11 +6,8 @@
import org.jboss.cache.GlobalTransaction;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.Node;
-import org.jboss.cache.NodeSPI;
import org.jboss.cache.TransactionEntry;
import org.jboss.cache.TransactionTable;
-import org.jboss.cache.TreeCache;
-import org.jboss.cache.TreeCacheProxyImpl;
import org.jboss.cache.config.Option;
import org.jboss.cache.loader.AsyncCacheLoader;
import org.jboss.cache.loader.CacheLoader;
@@ -20,7 +17,6 @@
import org.jboss.cache.marshall.MethodCallFactory;
import org.jboss.cache.marshall.MethodDeclarations;
-import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
@@ -33,7 +29,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.63 2006/11/29 22:10:22 genman Exp $
+ * @version $Id: CacheLoaderInterceptor.java,v 1.64 2006/12/20 02:16:24 msurtani Exp $
*/
public class CacheLoaderInterceptor extends BaseCacheLoaderInterceptor implements CacheLoaderInterceptorMBean
{
@@ -162,7 +158,7 @@
// clean up nodesCreated map
cleanupNodesCreated(entry);
break;
- default :
+ default:
if (!useCacheStore)
{
if (m.getMethodId() == MethodDeclarations.removeKeyMethodLocal_id)
@@ -314,11 +310,13 @@
private boolean mustLoad(Node n, Object key)
{
- if (n == null) {
+ if (n == null)
+ {
log.trace("mustLoad, node null");
return true;
}
- if (!n.getNodeSPI().getDataLoaded()) {
+ if (!n.getNodeSPI().getDataLoaded())
+ {
log.trace("must Load, uninitialized");
return true;
}
@@ -425,14 +423,17 @@
Map nodeData = loadData(fqn);
if (nodeData != null)
{
+ log.trace("Node data is not null, loading");
n = createNodes(fqn, entry);
cache.getInvocationContext().getOptionOverrides().setBypassInterceptorChain(true);
n.clearData();
cache.getInvocationContext().getOptionOverrides().setBypassInterceptorChain(true);
n.put(nodeData);
}
- else if (n != null && !n.getNodeSPI().getDataLoaded())
+
+ if (n != null && !n.getNodeSPI().getDataLoaded())
{
+ log.trace("Setting dataLoaded to true");
n.getNodeSPI().setDataLoaded(true);
}
return n;
1.44 +37 -37 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.43
retrieving revision 1.44
diff -u -b -r1.43 -r1.44
--- ActivationInterceptor.java 8 Dec 2006 18:49:17 -0000 1.43
+++ ActivationInterceptor.java 20 Dec 2006 02:16:24 -0000 1.44
@@ -25,7 +25,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.43 2006/12/08 18:49:17 genman Exp $
+ * @version $Id: ActivationInterceptor.java,v 1.44 2006/12/20 02:16:24 msurtani Exp $
*/
public class ActivationInterceptor extends CacheLoaderInterceptor implements ActivationInterceptorMBean
{
@@ -66,7 +66,7 @@
retval = super.invoke(m);
// is this a node removal operation?
- boolean nodeRemoved = false;
+ boolean removeData = false, nodeRemoved = false;
// 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)
@@ -83,7 +83,7 @@
Integer acts = (Integer) m_txActivations.get(gtx);
if (acts != null)
{
- m_activations = m_activations + acts.intValue();
+ m_activations = m_activations + acts;
}
m_txActivations.remove(gtx);
}
@@ -115,24 +115,13 @@
case MethodDeclarations.putDataMethodLocal_id:
case MethodDeclarations.putDataEraseMethodLocal_id:
case MethodDeclarations.putKeyValMethodLocal_id:
- fqn = (Fqn) args[1];
- break;
case MethodDeclarations.removeKeyMethodLocal_id:
- case MethodDeclarations.removeDataMethodLocal_id:
- fqn = (Fqn) args[1];
- break;
case MethodDeclarations.addChildMethodLocal_id:
fqn = (Fqn) args[1];
break;
case MethodDeclarations.getKeyValueMethodLocal_id:
- fqn = (Fqn) args[0];
- break;
case MethodDeclarations.getNodeMethodLocal_id:
- fqn = (Fqn) args[0];
- break;
case MethodDeclarations.getKeysMethodLocal_id:
- fqn = (Fqn) args[0];
- break;
case MethodDeclarations.getChildrenNamesMethodLocal_id:
case MethodDeclarations.releaseAllLocksMethodLocal_id:
case MethodDeclarations.printMethodLocal_id:
@@ -142,17 +131,27 @@
nodeRemoved = true;
fqn = (Fqn) args[1];
break;
+ case MethodDeclarations.removeDataMethodLocal_id:
+ removeData = true;
+ fqn = (Fqn) args[1];
+ break;
}
synchronized (this)
{
- if (fqn != null && nodeRemoved)
- // If the node is being removed, just remove it and don't perform
- // activation processing
+ if (fqn != null)
{
+ if (nodeRemoved)
+ {
+ log.trace("This is a remove operation; removing the node from the loader, no activation processing needed.");
loader.remove(fqn);
}
- else if (fqn != null && cache.hasChild(fqn) && loader.exists(fqn))
+ else if (removeData)
+ {
+ log.trace("This is a remove data operation; removing the data from the loader, no activation processing needed.");
+ loader.removeData(fqn);
+ }
+ else if (cache.hasChild(fqn) && loader.exists(fqn))
{
// Remove the node from the cache loader if it exists in memory,
// its attributes have been initialized, its children have been loaded,
@@ -178,6 +177,7 @@
}
}
}
+ }
return retval;
}
More information about the jboss-cvs-commits
mailing list