Hi guys,
I am trying to configure different eviction policies to different regions
dinamically and I am facing some problems.
This is what I want:
| Create an eviction policy in /NODE
| Create an evcition policy in /NODE/SUBNODE_1
| Create an eviction policy in /NODE/SUBNODE_2 and so on
| Even create an eviction policy in /NODE/SUBNODE_1/SUBNODE_A and so on
|
|
| I expected that I could create them dinamically as I am able to create them
using the tree cache config file, but I have encountered some problems.
|
| First of all, if I try to create a new eviction for, let's say
/NODE/SUBNODE_1, and /NODE already had one, it throws a
| RegionNameConflictException because at the time of creating the new Region
(/NODE/SUBNODE_1) it checks for region conflicts. As I see in the source code,
it will never allow to create a new Region under an existing one. Should work
that way?
|
| Secondly, I tried to remove any parent region of a given one from the
RegionManager to avoid conlflicts from first point, and then configure all
eviction policies bottom-up. That is, following last example, first I set an
evcition policy to /NODE/SUBNODE_1 and then to /NODE.
|
| In this case, it seems that everything is configured fine, but only the
eviction policy configured for every subnode is working. As I see, there are
no node entries in the eviction queue for the parent region, check it out
yourself below:
|
|
| | /NODE/
| | class org.jboss.cache.eviction.FIFOConfiguration
| | LFUConfiguration: maxNodes = 2
| | Nodes in eviction queue: 0
| |
| | /NODE/SUBNODE_1
| | class org.jboss.cache.eviction.FIFOConfiguration
| | LFUConfiguration: maxNodes = 5
| | Nodes in eviction queue: 2
| |
|
| This is, mainly, how I set the eviction policies:
|
|
| | public final void addEvictionPolicy(EvictionPolicy evictionPolicy,
| | String fqn) {
| | // Activate eviction Policies
| | RegionManager regionMgr =
getUnderlyingTreeCache().getEvictionRegionManager();
| | // get EvictionConfiguration
| | EvictionConfiguration config =
getEvictionConfiguration(evictionPolicy);
| | if (regionMgr.hasRegion(fqn)) {
| | Region region = regionMgr.getRegion(fqn);
| | region.setEvictionConfiguration(config);
| | logger.debug("Region[{}] configured with {}", fqn,
somEvictionPolicy);
| | } else {
| | EvictionPolicy policy = getEvictionPolicy(evictionPolicy);
| | policy.configure(getUnderlyingTreeCache());
| | try {
| | regionMgr.createRegion(fqn, policy, config);
| | } catch (RegionNameConflictException e) {
| | logger.error("Region Name conflict", e);
| | }
| | logger.debug(
| | "Region[{}] does not exist in RegionManager. Created and
configured with {}",
| | fqn, evictionPolicy);
| | }
| | }
| |
|
| Hope someone have any idea of how to set dinamically an eviction policy
over a region that already its own parent region has one set. By the way, I am
using JbossCache 1.4.1.SP8 and JbossAS-4.2.2
|
| I think this is a normal case that it could come up in a real application,
so I think that someone who already had at any time encountered this
requirement could help me.
|
| Thanks in advance!
|
|
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4148656#4148656
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4148656
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user