[jboss-user] [JBoss Cache: Core Edition] - Re: Create an eviction Region with a non empty nodeEventQueu
Sancheski
do-not-reply at jboss.com
Wed May 7 09:58:16 EDT 2008
I have a requirement in my application that forces me to create eviction policies to regions once the whole system is running (that is, the cache has already started and is runnning properly).
What I am triying to do is to configure an eviction policy programatically. Here is how I am doing it:
public final void addEvictionPolicy(EvictionPolicy evictionPolicy, EvictionConfiguration evictionConfig, String fqn)
| {
| // Activate eviction Policies
| RegionManager regionMgr = getUnderlyingTreeCache().getEvictionRegionManager();
| if (regionMgr.hasRegion(fqn)) {
| Region region = regionMgr.getRegion(fqn);
| region.setEvictionConfiguration(evictionConfig);
| logger.debug("Region[{}] configured with {}", fqn, evictionPolicy);
| } else {
| evictionPolicy.configure(getUnderlyingTreeCache());
| try {
| regionMgr.createRegion(fqn, evictionPolicy, evictionConfig);
| } catch (RegionNameConflictException e) {
| logger.error("Region Name conflict", e);
| }
| logger.debug(
| "Region[{}] does not exist in RegionManager. Created and configured with {}",
| fqn, evictionPolicy);
| }
| }
I do not know if there is a better way to create an eviction policy dinamically. Does any one know how to do it properly?
Thanks!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4149131#4149131
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4149131
More information about the jboss-user
mailing list