4 Replies Latest reply on Aug 4, 2009 10:36 AM by mjdinsmore

    LRU Eviction algorithm not removing nodes

      I am trying to use LRU eviction algorithm and in my application I created an LRU Eviction object with maxage as 3000 and set the cache region to the node-A and I added several nodes under the root node-A and put the thread to sleep for 1000 MS and I expected that while the thread is sleeping and after 3 seconds , all the nodes under the node "A" will be removed but it did not.

      Can somebody throw some light on this?


        • 1. Re: LRU Eviction algorithm not removing nodes

          I am seeing the same behavior. I'm on JBoss 4.2.2RC and appear to have the same setup, i.e.:






          • 2. Re: LRU Eviction algorithm not removing nodes

            I think I found the answer --

            Just put a double slash before your entity names, ie.

            <region name="//com/company/foobar">

            and then the entities will be evicted. There's a post on the Hibernate forum here:


            that was posted in April 2005, and says by someone on the Hibernate team,

            Ooops i kinda half noticed that but never really thought about why
            before.... It's fixed in CVS.

            But apparently the fix was lost or they thought they updated some document about it and that was promptly lost.[/url]

            • 3. Re: LRU Eviction algorithm not removing nodes

              @amurugan, maybe you wanna enable TRACE logging and add thread information to the logs to see what's going on underneath.

              @mjdinsmore region names for entities are not simply constructed with the class names, there's more information that you need to take in account such as the persistence unit...etc.

              Although http://www.jboss.org/community/wiki/ClusteredJPAHibernateSecondLevelCachinginJBossAS5 is an AS5 wiki, the hibernate.cache.region_prefix discussion also applies to 4.2.

              Unless you use hibernate.cache.region_prefix, the JPA deployer generates a path that you need to be aware of when defining evictions. The '//' seems to be some kind of trick to get around this but we haven't tested this at length and we haven't documented it, so can't guarantee it will work as expected.

              Finally, @mjdinsmore, your topic is different to amurugan's, so please stop hijacking other people's threads :)

              • 4. Re: LRU Eviction algorithm not removing nodes

                I wasn't aware I was hijacking the thread! :-)

                I had my caching set up and saw that things were getting put into the cache and never getting cleared (like Amurugan), so I added the extra slash (per the other post) to correct it. It seemed to work in that stale items were now getting flushed. I had made this addition in the treecache.xml file.