[jboss-cvs] JBossCache/src/org/jboss/cache/interceptors ...
Brian Stansberry
brian.stansberry at jboss.com
Mon Jan 29 00:10:28 EST 2007
User: bstansberry
Date: 07/01/29 00:10:28
Modified: src/org/jboss/cache/interceptors EvictionInterceptor.java
Log:
[JBCACHE-921] Cleanup up partially evicted nodes
Revision Changes Path
1.13 +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.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- EvictionInterceptor.java 4 Jan 2007 16:46:44 -0000 1.12
+++ EvictionInterceptor.java 29 Jan 2007 05:10:28 -0000 1.13
@@ -27,7 +27,7 @@
* This interceptor is used to handle eviction events.
*
* @author Daniel Huang
- * @version $Revision: 1.12 $
+ * @version $Revision: 1.13 $
*/
public class EvictionInterceptor extends Interceptor
{
@@ -60,6 +60,10 @@
handler = new PutKeyEvictionMethodHandler();
evictionMethodHandlers.put(MethodDeclarations.putKeyValMethodLocal_id, handler);
+
+ handler = new PartialEvictionEvictionMethodHandler();
+ evictionMethodHandlers.put(MethodDeclarations.evictNodeMethodLocal_id, handler);
+ evictionMethodHandlers.put(MethodDeclarations.evictVersionedNodeMethodLocal_id, handler);
}
/**
@@ -341,6 +345,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, NodeEventType.ADD_NODE_EVENT))
+ {
+ return new EvictedEventNode(fqn, NodeEventType.ADD_NODE_EVENT, 0);
+ }
+ }
+ return null;
+ }
+ }
+
protected interface EvictionMethodHandler
{
EvictedEventNode extractEvictedEventNode(MethodCall mc, Object retVal);
More information about the jboss-cvs-commits
mailing list