Updating cache when file is changed.

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

[1277 byte] By [bhomiapa] at [2007-11-27 10:25:36]
# 1

Guys..please help me in this...

I need to fix this issue ASAP..

Regards

Pankaj

bhomiaa at 2007-7-28 17:34:34 > top of Java-index,Java Essentials,Java Programming...
# 2

When you load the file, keep its timestamp. Every time you return an element from the cache check the file timestamp again. If it has changed, reload.

ejpa at 2007-7-28 17:34:34 > top of Java-index,Java Essentials,Java Programming...