This content has been marked as final.
Show 1 reply
-
1. Re: How could I create a new Region programmatically?
sancheski Jun 14, 2007 12:12 PM (in response to sancheski)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.