Howdy,
It won't be a technical problem if you implement your threads well, but
it's a semantic issue.  The conclusion of the contextInitialized event
means the context is ready to receive requests.  If your background
threads are still running, if your webapp ready to handle requests?
Your servlets need to be coded such that if requests arrive and those
Maps are not ready, the servlets handle it gracefully.

Alternatively, consider a filter to check on the status of the threads
and deny requests until they're done.

Yoav Shapira
Millennium ChemInformatics


>-----Original Message-----
>From: Wendy Smoak [mailto:[EMAIL PROTECTED]
>Sent: Wednesday, December 17, 2003 10:20 AM
>To: Tomcat Users List
>Subject: Okay to create threads in ServletContextListener?
>
>
>I'm getting complaints that Tomcat takes for-ev-er to start up, and the
>thing that's taking so long is all my ServletContextListeners (one for
>each webapp) going out to the database and loading a bunch of Maps into
>application scope.  Later, those get used to populate select lists.
>
>Not that we restart Tomcat very often, but when we do, it causes
>problems when Tomcat doesn't completely finish starting before Apache
>starts.  We end up restarting them twice to get all the generated
config
>files in place.
>
>Is it going to break anything if I let life go on with the rest of the
>startup while some threads wait for the information from the database?
>(I haven't done much concurrent programming, just a few tutorials and
>school assignments, so stop me now if this is a really bad idea.)
>
>--
>Wendy Smoak
>Application Systems Analyst, Sr.
>ASU IA Information Resources Management
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to