You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by ro...@st.com on 2002/06/07 15:40:20 UTC

Re: Problem with doPost() method executed twice in paralle

     Maybe you're right but I forgot to precise some things :
     - for the moment I'm the only user testing my application so there is 
     no risk that another user creates a new thread by connecting.
     - the external classes are objects stored in session


______________________________ Reply Separator _________________________________
Subject: Re: Problem with doPost() method executed twice in paralle
Author:  tmo (tmo@ebi.ac.uk) at internet
Date:    6/7/02 3:15 PM


     
     
rosset.synlog@st.com wrote:
     
>      And suddenly, whereas the code is executing in an extern method, the 
>      traces situed at the begin of doPost() method are displayed a second 
>      time !!!
>      It looks like if doPost() method was executed a second time IN
>      PARALLEL of the first doPost() (because the external methods issued 
>      from the first doPost() continue to execute).
     
This is correct. The servlet container will create a single instance of 
the servlet class that you have written, calling the init() method at 
the time of creation. After this, each request to your servlet will map 
to a separate thread, all of which run through the same object (your 
servlet).
     
If you are accessing external objects as part of this process, you must 
ensure that either your external resources are created per-access, so 
created and referenced within the doPost() method, or that they are 
thread safe, as you have no control over when they are accessed.
     
Exactly why you are getting two invocations of your doPost() call is 
unclear, it depends on what is trying to access it, but this kind of 
behavior is common and intentional.
     
Hope that helps,
     
Tom Oinn
     
--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org> 
For additional commands, e-mail: <ma...@jakarta.apache.org>
     


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>