I've been attempting to pull hard-coded configuration data from a Tomcat web-app which I'm working on, into JNDI (web.xml) to make the app more configurable. Instead of continuously doing lookups into the InitialContext, I'm caching the lookups and the InitialContext using a singleton.
Of course, when I stop and start the application, the static instance of my singleton remains alive -- therefore, the cache doesn't get "refreshed". My question is dual -- I'm isolating this singleton to a single web application -- are there any unforeseen effects in Tomcat [I've read that singleton's & tomcat don't mix]? And what is the easiest way to clear the singleton instance when the application is stopped (I was thinking of writing a separate ServerContextListener which would clear the instance).
(Note: I apologize if I used the terminology incorrectly -- please correct -- this is my first foray into programming with Tomcat)