Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JBoss User Help »

[jboss-user] [JBossCache] - Re: How could I create a new Region
 programmatically?

scott.stark@jboss.org

2007-06-14


I think I found the solution, perhaps it is gonna be usefull for someone.

The code below could be used as an example:


| //getting the cache's eviction RegionManager
| RegionManager regionMgr = cache.getEvictionRegionManager();
|
| //Creating your own EvictionConfiguration
| FIFOConfiguration config = new FIFOConfiguration();
| ((FIFOConfiguration) config).setMaxNodes(10);
|
| //New instance of an EvictionPolicy
| FIFOEviction eviction = new FIFOPolicy();
| //Configure eviction policy in the cache instance
| eviction.configure(cache);
| //finally, create the region
| regionMgr.createRegion("/foo/com", eviction, config);
|
|

What I was missing was the eviction configuration in the cache instance (eviction.configure(cache);) so I got a NullPointerException when the Timer threads did periodic node clean up by running the eviction policy.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4054479#4054479

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4054479
_______________________________________________
jboss-user mailing list
jboss-user@(protected)
https://lists.jboss.org/mailman/listinfo/jboss-user
©2008 junlu.com - Jax Systems, LLC, U.S.A.