loredana loredana wrote:
> I have a pretty big website that uses java cache from which it retrieves the 
> html. So I have a scheduled job(servlet) that get's some data from a server 
> and stores it in a java cache(Oscache or Ehcache for those who know it). My 
> problem is next: whenever the server (tomcat) is restarted, the cache is 
> emptyed and should be "populated" when the server is back on.So long story 
> short...is there any way to run a servlet whenever tomcat starts? so when 
> tomcat starts, a servlet should be run. I don't know if that's possible but 
> can someone tell me if it is and how it should be done?

Implement a ServletContextListener, it has two methods, one of each of
which fire respectively when the Context is started and when it is
terminated.

You can place your cache populating code in the startup method.

p



> 10x
> 
> 
> 
> 
>        
> ____________________________________________________________________________________
> Be a better Heartthrob. Get better relationship answers from someone who 
> knows. Yahoo! Answers - Check it out. 
> http://answers.yahoo.com/dir/?link=list&sid=396545433
> 
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to