tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yoav Shapira" <yo...@apache.org>
Subject Re: How to load a static class on Tomcat startup
Date Fri, 01 Jun 2007 15:53:11 GMT
Hey,
Use ServletContextListener's contextInitialized method.  In it you can
do your Class.forName call or whatever other way you want to load the
class.  This is portable and doesn't depend on Tomcat's internal
implementation.

Also, this is not a question for the dev mailing list, but for the
users mailing list.  Please see  http://tomcat.apache.org/lists.html
and if you have follow-up questions, post them on the users mailing
list.  Thanks,

Yoav


On 6/1/07, atreyuas@ngi.it <atreyuas@ngi.it> wrote:
> Hello everybody,
> I want to know how I can configure Tomcat to load a Singleton class on his
> startup routine? This class implement a cache that I want to stay in memory
> until Tomcat is shutted down.
>
> I've read about context but it seem to load the class only on a particular URL
> request..
>
> I want the class to be loaded with Tomcat, without any request is made.
>
> Thanks to all
>
> Andrea
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message