I'm working on a J2EE solution which loads configuration information from an XML file. This information is needed by various pieces, so I have a stateless session bean that clients can use. Whenever an instance of the session bean is created, it loads the contents of the XML file and can then service requests until it is destroyed. This all works just fine, but I need a way to have the configuration information reloaded whenever it changes. I've tried numerous approaches already, but none fit the bill.
One approach was to check the modified timestamp on the config file whenever information was requested. This works, but results in way too many disk accesses to be scalable.
Another approach is to use a file listener and poll for changes to the file periodically. This would work except that I can't find a way to force all instantiated copies to reload. I could set a flag and have them check it on every access, but I can't rely on this working in a container with multiple class loaders (not all instances would be able to see the flag).
Any ideas?
-
Auto-reloading stateless session beans (1 messages)
- Posted by: Hilton Campbell
- Posted on: October 03 2005 14:18 EDT
Threaded Messages (1)
- Auto-reloading stateless session beans by Dmitri Maximovich on October 04 2005 00:56 EDT
-
Auto-reloading stateless session beans[ Go to top ]
- Posted by: Dmitri Maximovich
- Posted on: October 04 2005 00:56 EDT
- in response to Hilton Campbell
Why don't you check timestamp not on every request but just once in several minutes/hours/days etc?