tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "eric chacon" <chacone...@hotmail.com>
Subject RE: How to execute a class on startup (Tomcat 3.2.1) ?
Date Tue, 17 Apr 2001 11:56:25 GMT

Spencer,

This is not exactly what you're looking for, but it is a practicle solution 
to the problem (one which I have used on occassion)--

For application wide initialization, I create a singleton 
(ApplicationInitializationSingleton) that performs all of my initialization 
work.

I create a parent-class servlet for all of the servlets in my 
initialization, and its init() method calls super() (of course), and then 
the applicationInitialize() method of my Singleton.

This insures that the application is initialized before any significant work 
begins, but initialization is dependent on which servlet gets called first.

The caveat is that you have to make sure that ALL of your servlets that are 
in ANY way depdendent on initialization subclass your parent servlet class.

Hope this helps,
E.

> > > Hi, > > I'm wondering how I can have Tomcat 3.2.1 execute a class (not

>a servlet) > when it starts up. > > Thanks. > > Spencer > >
>
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com


Mime
View raw message