[jboss-cvs] JBossCache/src/org/jboss/cache/interceptors ...
Brian Stansberry
brian.stansberry at jboss.com
Wed Oct 11 23:39:59 EDT 2006
User: bstansberry
Date: 06/10/11 23:39:59
Modified: src/org/jboss/cache/interceptors EvictionInterceptor.java
Log:
[JBCACHE-801] Restore EvictionPolicy ability to ignore events based on event type
Revision Changes Path
1.7 +27 -21 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.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- EvictionInterceptor.java 25 Aug 2006 14:10:07 -0000 1.6
+++ EvictionInterceptor.java 12 Oct 2006 03:39:59 -0000 1.7
@@ -12,6 +12,7 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
import org.jboss.cache.eviction.EvictedEventNode;
+import org.jboss.cache.eviction.NodeEventType;
import org.jboss.cache.eviction.Region;
import org.jboss.cache.eviction.RegionManager;
import org.jboss.cache.marshall.MethodDeclarations;
@@ -26,7 +27,7 @@
* This interceptor is used to handle eviction events.
*
* @author Daniel Huang
- * @version $Revision: 1.6 $
+ * @version $Revision: 1.7 $
*/
public class EvictionInterceptor extends Interceptor
{
@@ -131,9 +132,9 @@
return handler.extractEvictedEventNode(m, retVal);
}
- protected boolean canIgnoreEvent(Fqn fqn)
+ protected boolean canIgnoreEvent(Fqn fqn, NodeEventType type)
{
- return regionManager.getRegion(fqn).getEvictionPolicy().canIgnoreEvent(fqn);
+ return regionManager.getRegion(fqn).getEvictionPolicy().canIgnoreEvent(fqn, type);
}
protected void doEventUpdatesOnRegionManager(EvictedEventNode event)
@@ -164,14 +165,13 @@
Object args[] = mc.getArgs();
Fqn fqn = (Fqn) args[0];
- if (fqn != null && !EvictionInterceptor.this.canIgnoreEvent(fqn))
+ if (fqn != null && !EvictionInterceptor.this.canIgnoreEvent(fqn, NodeEventType.VISIT_NODE_EVENT))
{
- Region region = EvictionInterceptor.this.regionManager.getRegion(fqn);
- if (region.getEvictionPolicy().canIgnoreEvent(fqn))
+ if (fqn != null
+ && !EvictionInterceptor.this.canIgnoreEvent(fqn, NodeEventType.VISIT_NODE_EVENT))
{
- return null;
+ return new EvictedEventNode(fqn, NodeEventType.VISIT_NODE_EVENT);
}
- return new EvictedEventNode(fqn, EvictedEventNode.VISIT_NODE_EVENT);
}
return null;
@@ -195,9 +195,10 @@
Object args[] = mc.getArgs();
Fqn fqn = (Fqn) args[0];
Object key = args[1];
- if (fqn != null && key != null && !EvictionInterceptor.this.canIgnoreEvent(fqn))
+ if (fqn != null && key != null
+ && !EvictionInterceptor.this.canIgnoreEvent(fqn, NodeEventType.VISIT_NODE_EVENT))
{
- return new EvictedEventNode(fqn, EvictedEventNode.VISIT_NODE_EVENT);
+ return new EvictedEventNode(fqn, NodeEventType.VISIT_NODE_EVENT);
}
return null;
@@ -212,9 +213,10 @@
Object args[] = mc.getArgs();
Fqn fqn = (Fqn) args[1];
- if (fqn != null && !EvictionInterceptor.this.canIgnoreEvent(fqn))
+ if (fqn != null
+ && !EvictionInterceptor.this.canIgnoreEvent(fqn, NodeEventType.REMOVE_NODE_EVENT))
{
- return new EvictedEventNode(fqn, EvictedEventNode.REMOVE_NODE_EVENT);
+ return new EvictedEventNode(fqn, NodeEventType.REMOVE_NODE_EVENT);
}
return null;
@@ -239,9 +241,10 @@
Object args[] = mc.getArgs();
Fqn fqn = (Fqn) args[1];
Object key = args[2];
- if (fqn != null && key != null && !EvictionInterceptor.this.canIgnoreEvent(fqn))
+ if (fqn != null && key != null
+ && !EvictionInterceptor.this.canIgnoreEvent(fqn, NodeEventType.REMOVE_ELEMENT_EVENT))
{
- return new EvictedEventNode(fqn, EvictedEventNode.REMOVE_ELEMENT_EVENT, 1);
+ return new EvictedEventNode(fqn, NodeEventType.REMOVE_ELEMENT_EVENT, 1);
}
return null;
}
@@ -255,7 +258,8 @@
Object[] args = mc.getArgs();
Fqn fqn = (Fqn) args[1];
Map putData = (Map) args[2];
- if (fqn != null && !EvictionInterceptor.this.canIgnoreEvent(fqn))
+ if (fqn != null
+ && !EvictionInterceptor.this.canIgnoreEvent(fqn, NodeEventType.ADD_NODE_EVENT))
{
if (putData == null)
{
@@ -273,7 +277,7 @@
size = putData.size();
}
- return new EvictedEventNode(fqn, EvictedEventNode.ADD_NODE_EVENT, size);
+ return new EvictedEventNode(fqn, NodeEventType.ADD_NODE_EVENT, size);
}
return null;
@@ -289,7 +293,8 @@
Fqn fqn = (Fqn) args[1];
Map putData = (Map) args[2];
Boolean resetElementCount = (Boolean) args[4];
- if (fqn != null && !EvictionInterceptor.this.canIgnoreEvent(fqn))
+ if (fqn != null
+ && !EvictionInterceptor.this.canIgnoreEvent(fqn, NodeEventType.ADD_NODE_EVENT))
{
if (putData == null)
{
@@ -307,7 +312,7 @@
size = putData.size();
}
- EvictedEventNode event = new EvictedEventNode(fqn, EvictedEventNode.ADD_NODE_EVENT, size);
+ EvictedEventNode event = new EvictedEventNode(fqn, NodeEventType.ADD_NODE_EVENT, size);
event.setResetElementCount(resetElementCount.booleanValue());
return event;
}
@@ -323,9 +328,10 @@
Object[] args = mc.getArgs();
Fqn fqn = (Fqn) args[1];
Object key = args[2];
- if (fqn != null && key != null && !EvictionInterceptor.this.canIgnoreEvent(fqn))
+ if (fqn != null && key != null
+ && !EvictionInterceptor.this.canIgnoreEvent(fqn, NodeEventType.ADD_ELEMENT_EVENT))
{
- return new EvictedEventNode(fqn, EvictedEventNode.ADD_ELEMENT_EVENT, 1);
+ return new EvictedEventNode(fqn, NodeEventType.ADD_ELEMENT_EVENT, 1);
}
return null;
More information about the jboss-cvs-commits
mailing list