On Fri, 1 Mar 2002, Lauer, Oliver wrote:
> Date: Fri, 1 Mar 2002 17:47:11 +0100
> From: "Lauer, Oliver" <[EMAIL PROTECTED]>
> Reply-To: Tomcat Users List <[EMAIL PROTECTED]>
> To: 'Tomcat Users List' <[EMAIL PROTECTED]>
> Subject: AW: Own Threads within TC ?
>
> Thanks, good to know, is it ok to reference my ServletContext within 'my'
> threads ?
> Oliver
>
As long as the webapp is still running, that should be ok.
How do you know? You should register a ServletContextListener that is
notified when the application is started and shut down. (This is also a
good place to create and destroy the threads themselves.)
Craig
> > AXA eSolutions GmbH
> > AXA Konzern AG Germany
> > Oliver Lauer
> > Web Architect
> > W�rthstra�e 34
> > D-50668 K�ln
> > Germany
> > Tel.: +49 221 148 31277
> > Fax: +49 221 148 43963
> > Mobil: +49 179 59 064 59
> > e-Mail: [EMAIL PROTECTED]
> > _____________________________
> >
>
>
> -----Urspr�ngliche Nachricht-----
> Von: Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
> Gesendet: Freitag, 1. M�rz 2002 17:42
> An: Tomcat Users List
> Betreff: Re: Own Threads within TC ?
>
>
>
>
> On Fri, 1 Mar 2002, Lauer, Oliver wrote:
>
> > Date: Fri, 1 Mar 2002 16:41:17 +0100
> > From: "Lauer, Oliver" <[EMAIL PROTECTED]>
> > Reply-To: Tomcat Users List <[EMAIL PROTECTED]>
> > To: "Tomcat Users List (E-Mail)" <[EMAIL PROTECTED]>
> > Subject: Own Threads within TC ?
> >
> > Hi,
> >
> > I know within an EJB container you mustn't use threads although in some
> you
> > can either. How is that topic related to TC.
> > I know I can use threads within TC but what does the spec. says about
> > threads ? I want to start some within a servlet's init() and stop those
> > using the destroy() method.
> >
> > Is that ok and allowed as well ?
> >
>
> Tomcat itself doesn't stop you from doing this (unless you run under a
> security manager with a policy that prohibits thread creation). A couple
> of things to keep in mind:
>
> * Threads should normally be created as daemon threads
> (thread.setDaemon(true) after creation). Otherwise,
> Tomcat will hang forever at shutdown time unless your
> code correctly cleans up the threads it created.
>
> * It is not valid to keep a reference to objects provided
> by the container (HttpServletRequest, HttpServletResponse)
> beyond the scope of a particular call to the service()
> method of your servlet. You'll need to copy everything
> you need out of these objects before the servlet call
> finishes.
>
> > Thanks
> > Oliver
> >
>
> Craig
>
>
> --
> To unsubscribe: <mailto:[EMAIL PROTECTED]>
> For additional commands: <mailto:[EMAIL PROTECTED]>
> Troubles with the list: <mailto:[EMAIL PROTECTED]>
>
>
> ------------------------------------------------------------------------------
> Aus Rechts- und Sicherheitsgruenden ist die in dieser E-Mail gegebene Information
>nicht rechtsverbindlich. Eine rechtsverbindliche Bestaetigung reichen wir Ihnen gerne
>auf Anforderung in schriftlicher Form nach. Beachten Sie bitte, dass jede Form der
>unautorisierten Nutzung, Veroeffentlichung, Vervielfaeltigung oder Weitergabe des
>Inhalts dieser E-Mail nicht gestattet ist.Diese Nachricht ist ausschliesslich fuer
>den bezeichneten Adressaten oder dessen Vertreter bestimmt. Sollten Sie nicht der
>vorgesehene Adressat dieser E-Mail oder dessen Vertreter sein, so bitten wir Sie,
>sich mit dem Absender der E-Mail in Verbindung zu setzen.
> ----------------------------
> For legal and security reasons the information provided in this e-mail is not
>legally binding. Upon request we would be pleased to provide you with a legally
>binding confirmation in written form. Any form of unauthorised use, publication,
>reproduction, copying or disclosure of the content of this e-mail is not permitted.
>This message is exclusively for the person addressed or their representative. If you
>are not the intended recipient of this message and its contents, please notify the
>sender immediately.
>
> ==============================================================================
>
>
> --
> To unsubscribe: <mailto:[EMAIL PROTECTED]>
> For additional commands: <mailto:[EMAIL PROTECTED]>
> Troubles with the list: <mailto:[EMAIL PROTECTED]>
>
>
--
To unsubscribe: <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>