tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lauer, Oliver" <Oliver.La...@AXA.de>
Subject AW: AW: Own Threads within TC ?
Date Fri, 01 Mar 2002 16:54:55 GMT
Craig, I did it in the Servlet's init() and destroy() ?? 
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
> _____________________________
> 


-----Ursprüngliche Nachricht-----
Von: Craig R. McClanahan [mailto:craigmcc@apache.org]
Gesendet: Freitag, 1. März 2002 17:52
An: Tomcat Users List
Betreff: Re: AW: Own Threads within TC ?




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

> Date: Fri, 1 Mar 2002 17:47:11 +0100
> From: "Lauer, Oliver" <Oliver.Lauer@AXA.de>
> Reply-To: Tomcat Users List <tomcat-user@jakarta.apache.org>
> To: 'Tomcat Users List' <tomcat-user@jakarta.apache.org>
> 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: Oliver.Lauer@axa.de
> > _____________________________
> >
>
>
> -----Ursprüngliche Nachricht-----
> Von: Craig R. McClanahan [mailto:craigmcc@apache.org]
> 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" <Oliver.Lauer@AXA.de>
> > Reply-To: Tomcat Users List <tomcat-user@jakarta.apache.org>
> > To: "Tomcat Users List (E-Mail)" <tomcat-user@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:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
> For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
> Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>
>
>
>
----------------------------------------------------------------------------
--
> 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:tomcat-user-unsubscribe@jakarta.apache.org>
> For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
> Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>
>
>


--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


------------------------------------------------------------------------------
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:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message