You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by loredana loredana <lo...@yahoo.com> on 2007/10/15 09:38:28 UTC

tomcat and java cache

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?

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: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: tomcat and java cache

Posted by Pid <p...@pidster.com>.
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: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 


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


Re: tomcat and java cache

Posted by Johnny Kewl <jo...@kewlstuff.co.za>.
---------------------------------------------------------------------------
HARBOR: http://coolharbor.100free.com/index.htm
Now Tomcat is also a cool application server
---------------------------------------------------------------------------

in theory load-on-startup
<servlet>

<servlet-name>YourSelvelet</servlet-name>

<servlet-class>blah.blah</servlet-class>

<load-on-startup> 1 </load-on-startup>

</servlet>

and then in the servlet itself the INIT section will run so you can do your 
thing there.

Dont know this OSCache tool... but you must be caching like crazy if letting 
the first request set it up is going to take too long.... have fun


----- Original Message ----- 
From: "loredana loredana" <lo...@yahoo.com>
To: <us...@tomcat.apache.org>
Sent: Monday, October 15, 2007 9:38 AM
Subject: tomcat and java cache


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?

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: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org



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


Re: tomcat and java cache

Posted by Leon Rosenberg <ro...@googlemail.com>.
Thats what listener are for, in your case ContextListener.
regards
Leon

On 10/15/07, loredana loredana <lo...@yahoo.com> 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?
>
> 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: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

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