So here is the config for the test
| <region name="/evictiontest/LRU" policyClass="org.jboss.cache.eviction.LRUPolicy"> | <attribute name="maxNodes">3</attribute> | <attribute name="timeToLiveSeconds">30</attribute> | <attribute name="maxAgeSeconds">30</attribute> | </region> | | My sample test case | public void evictionTest(String configPath) throws Exception{ | CacheFactory factory = DefaultCacheFactory.getInstance(); | Cache cache = factory.createCache(configPath); | CacheJmxWrapperMBean wrapper = new CacheJmxWrapper(cache); | wrapper.create(); | wrapper.start(); | System.out.println("Cache created"); | | String lruPath="/evictiontest/LRU/a/b/c"; | Fqn lruFQN =Fqn.fromString(lruPath); | | String expPath="/evictiontest/EXP/a/b/c"; | Fqn expFQN =Fqn.fromString(expPath); | | String key ="data"; | HashMap testData = new HashMap(); | testData.put("Client", "Bond,James"); | | cache.put(lruFQN,key, testData); | | HashMap val = (HashMap)cache.get(lruFQN, key); | System.out.println("Value taken from hash "+val.toString()); | | //Test Max Nodes attribute now and how that works | for(int i = 0; i < 10 ;i ++){ | lruFQN =Fqn.fromString(lruPath+i); | cache.put(lruFQN,key, testData); | } | System.out.println("Added more nodes than allowed to region " + wrapper.printCacheDetails()); | | int counter = 0; | while(true){ | counter = counter + 10; | Thread.currentThread().sleep(10000); | System.out.println("Slept "+counter +" secs " + wrapper.printCacheDetails()); | | } | | Output that i see | Cache created | Value taken from hash {Client=Bond,James} | Added more nodes than allowed to region / null | /evictiontest null | /LRU null | /a null | /b null | /c5 {data={Client=Bond,James}} | /c6 {data={Client=Bond,James}} | /c8 {data={Client=Bond,James}} | /c {data={Client=Bond,James}} | /c7 {data={Client=Bond,James}} | /c9 {data={Client=Bond,James}} | /c2 {data={Client=Bond,James}} | /c0 {data={Client=Bond,James}} | /c1 {data={Client=Bond,James}} | /c4 {data={Client=Bond,James}} | /c3 {data={Client=Bond,James}} | | Slept 10 secs / null | /evictiontest null | /LRU null | /a null | /b null | /c8 {data={Client=Bond,James}} | /c7 {data={Client=Bond,James}} | /c9 {data={Client=Bond,James}} | | Slept 20 secs / null | /evictiontest null | /LRU null | /a null | /b null | /c8 {data={Client=Bond,James}} | /c7 {data={Client=Bond,James}} | /c9 {data={Client=Bond,James}} | | Slept 30 secs / null | /evictiontest null | /LRU null | /a null | /b null | /c8 {data={Client=Bond,James}} | /c7 {data={Client=Bond,James}} | /c9 {data={Client=Bond,James}} | | Slept 40 secs / null | /evictiontest null | /LRU null | /a null | /b null | | Eviction timer thread runs every 3 seconds. So back to the original question, how does maxNodes work?? Its configured as 3, so is that 3 nodes with data below the region or is it 3 nodes regardless of data below the region?? It looks to me like it is nodes with data!! Is this the expected behaviour?? The remaining 3 records get evicted after they have lived their life expectancy of 30 seconds. By the way this last test was carried out with 3.x version but the original test was done with the 2.x version. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4185658#4185658 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4185658 _______________________________________________ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user