[jboss-cvs] JBossCache/src/org/jboss/cache/interceptors ...
Brian Stansberry
brian.stansberry at jboss.com
Mon Jan 29 00:24:59 EST 2007
User: bstansberry
Date: 07/01/29 00:24:59
Modified: src/org/jboss/cache/interceptors Tag:
Branch_JBossCache_1_4_0 EvictionInterceptor.java
Log:
[JBCACHE-921] Cleanup up partially evicted nodes
Revision Changes Path
No revision
No revision
1.3.2.2 +28 -1 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.3.2.1
retrieving revision 1.3.2.2
diff -u -b -r1.3.2.1 -r1.3.2.2
--- EvictionInterceptor.java 9 Aug 2006 12:30:12 -0000 1.3.2.1
+++ EvictionInterceptor.java 29 Jan 2007 05:24:59 -0000 1.3.2.2
@@ -26,7 +26,7 @@
* This interceptor is used to handle eviction events.
*
* @author Daniel Huang
- * @version $Revision: 1.3.2.1 $
+ * @version $Revision: 1.3.2.2 $
*/
public class EvictionInterceptor extends Interceptor
{
@@ -61,6 +61,10 @@
evictionMethodHandlers.put(MethodDeclarations.putKeyValMethodLocal, handler);
evictionMethodHandlers.put(MethodDeclarations.putFailFastKeyValueMethodLocal, handler);
+ handler = new PartialEvictionEvictionMethodHandler();
+ evictionMethodHandlers.put(MethodDeclarations.evictNodeMethodLocal, handler);
+ evictionMethodHandlers.put(MethodDeclarations.evictVersionedNodeMethodLocal, handler);
+
}
/**
@@ -336,6 +340,29 @@
}
+ protected class PartialEvictionEvictionMethodHandler implements EvictionMethodHandler
+ {
+ public EvictedEventNode extractEvictedEventNode(MethodCall mc, Object retVal)
+ {
+ // See if the node still exists; i.e. was only data removed
+ // because it still has children.
+ // If yes, put an ADD event in the queue so the node gets revisited
+
+ boolean complete = (retVal != null && ((Boolean) retVal).booleanValue());
+ if (!complete)
+ {
+ Object[] args = mc.getArgs();
+ Fqn fqn = (Fqn) args[0];
+ if (fqn != null
+ && !EvictionInterceptor.this.canIgnoreEvent(fqn))
+ {
+ return new EvictedEventNode(fqn, EvictedEventNode.ADD_NODE_EVENT, 0);
+ }
+ }
+ return null;
+ }
+ }
+
protected interface EvictionMethodHandler
{
EvictedEventNode extractEvictedEventNode(MethodCall mc, Object retVal);
More information about the jboss-cvs-commits
mailing list