2 Replies Latest reply: Jul 15, 2007 7:22 PM by EJP RSS

    Updating cache when file is changed.

    807605
      Hi all,

      I am working on a "Resource Manager" module in java. What it does is :
      1. Read the configuration file from a location(proerty name/value pair).
      2. Loads the file properties in a cache which holds the in a CachedHashMap as Key-Value pair

      The same config file which it reads looks like this:
      <config>
               <client>
                         <id>1</id>
                         <application>
                                 <id>213</id>
                                 <name> MyApp </name>
                                 <property>
                                           <name> key1 </name>
                                            <value> value1 </value>
                                 </property>
                                 <property>
                                           <name> key2 </name>
                                            <value> value2 </value>
                                 </property>
                          </application?
               </client>
      </config>
      This reading from config file and storing in cache I have already implemented ..

      But now I have a special requirement.. If after deploying the application, I modify the file then Resource Manager should be smart enuf to detect the change and the reloads the file , cleans the cache and updates the cache..

      Can you guys please through an idea on how to achieve the same??? It has to be Server Independent... I mean no JMX..

      a small small code will b more useful..
      Thanks in advance
      Pankaj