0 Replies Latest reply on Oct 20, 2008 8:09 AM by Thiagu Mariappan

    Static cache issue

    Thiagu Mariappan Novice

      Hi everyone

      I am trying to use  java static cache in seam to improve the performance.
      The static cache mean created a static map variable in our java class. Then, I initialize the Static map within static block of our java class. The static map should not get garbage collected and also gets initialized before any method in our application is executed. So it is persistent in the whole application until we kill the server process. So when ever we need the data we can get it from the static map variable.

      So I implemented this approach within my seam application.

      •     I create a static hash map in my one of the seam component.

      •     The seam component is in APPLICATION scope.

      •     Then I initialize static hash map within @Create method and load the data in it.

      It works fine, but after some period of time, I realize the static hash map is getting
      Garbage collected and crashes my application. How do I prevent the garbage collection of the static hash map that appears to be occurring here?