You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Lauer, Oliver" <Ol...@AXA.de> on 2002/03/01 16:41:17 UTC

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 ? 

Thanks
Oliver 

> 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: Oliver.Lauer@axa.de
> _____________________________
> 
> 

------------------------------------------------------------------------------
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:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>


Re: Own Threads within TC ?

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Fri, 1 Mar 2002, Lauer, Oliver wrote:

> Date: Fri, 1 Mar 2002 16:41:17 +0100
> From: "Lauer, Oliver" <Ol...@AXA.de>
> Reply-To: Tomcat Users List <to...@jakarta.apache.org>
> To: "Tomcat Users List (E-Mail)" <to...@jakarta.apache.org>
> 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:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>