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

Sancheski do-not-reply at jboss.com
Thu Jun 14 12:12:06 EDT 2007


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



More information about the jboss-user mailing list