[jboss-user] [JBoss Cache: Core Edition] - Re: Request for Guide for creating new eviction policies
jorgemoralespou_2
do-not-reply at jboss.com
Tue Apr 7 06:33:06 EDT 2009
So far, for my requisites, I have to modify only one of JBoss Core classes, to make it possible to work. In some cases, it should be advisable to modify some other classes with instanceof statements, not required in my cases.
I have made a new interface, extending EvictionQueue, named SubcontextEvitionQueue with this code:
| public interface SubcontextEvictionQueue extends EvictionQueue {
| NodeEntry getFirstNodeEntry(Fqn fqn);
| void modifyElementCount(Fqn fqn, int difference);
| int getNumberOfNodes(Fqn fqn);
| int getNumberOfElements(Fqn fqn);
| }
|
And modified:
| public void NodeEntry.setNumberOfElements(int numberOfElements)
| {
| if (queue != null)
| {
| int difference = numberOfElements - this.numberOfElements;
| if (queue instanceof SubcontextEvictionQueue){
| queue.modifyElementCount(difference);
| }else{
| queue.modifyElementCount(fqn, difference);
| }
| }
| this.numberOfElements = numberOfElements;
| }
|
This make it possible to create an EvictionAlgorithm/EvictionQueue assigned to a region, that handles number of items in subnodes, without the need for creating a region infraestructure.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4223982#4223982
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4223982
More information about the jboss-user
mailing list