Hi,
I am needing to hold a cache of data from the database, I load the data at the startup of my webapp and put in the application context via the contextListener, this is fine.
However what I want to do is periodocally check the database to see if this cache needs updating, I want this check to be automatic, eg every hour.
Has anyone got any ideas how to achieve this automatic update to an object on the application scope?
any ideas/opinions appriciated.
Thanks for the suggestion.
I'll take a look at the quartz solution.
Alternatively how about if I start off a thread in the contextListener and leave it running in a loop?
Instead of creating your own thread that runs continuously, use the java.util.Timer and TimerTask classes. Those allow you to schedule tasks for periodic execution.