tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwirirai <kwiri...@designat7.co.zw>
Subject Re: Servlet thread safety in Tomcat
Date Mon, 09 Feb 2004 18:50:48 GMT
Thanks ,It realy means I have to redesign the whole app ....,but there 
is the issue of networking and Java Mail, it seems the other servlet has 
to wait for a very long time for the other servlet to get all the 
mail.My question is can Tomcat process two sessions of a servlet  
downloading mail at the same time sopposing the other session is 
slow.Will the one with a faster connection finish first or will have to 
wait for the one with slow connection...?

Mike Curwen wrote:

>The one thing that could be said (so far), is to ensure you are using
>properly scoped variables.  Generally speaking, for servlets, that means
>don't use something like the following:
>
>public class myservlet extends HttpServlet {
>
>   private String MyBadlyPlacedVariable = null;
>
>   public void doGet() { // exceptions and parameters snipped for
>brevity
>      
>        MyBadlyPlacedVariable =
>request.getParameter("some_variable_used_later");
> 
>        // later on in the code, use "MyBadlyPlacedVariable"...
>        // it probably contains a value you're not expecting!
>   }
>}
>
>
>You'll for sure experince threading problems, and this is the most
>likely cause of any class of problems that's generically described as:
>"the data is actualy mixing up".
>
>  
>
>>    
>>
>>>-----Original Message-----
>>>From: kwirirai [mailto:kwirirai@designat7.co.zw]
>>>Sent: Monday, February 09, 2004 12:48 PM
>>>To: tomcat-user@jakarta.apache.org
>>>Subject: Servlet thread safety in Tomcat
>>>
>>>Hi All
>>>I am developing an application that uses JavaMail.What I am 
>>>      
>>>
>>concered is 
>>    
>>
>>>the issue of thread safety,and efficiency.My question is do 
>>>      
>>>
>>I need to 
>>    
>>
>>>employ synchronized blocks in my Servlet code or is there another way
>>>      
>>>
>>to
>>    
>>
>>>implement thread safety.I have been experimenting with the 
>>>      
>>>
>>application 
>>    
>>
>>>and I have seen that the data is actualy mixing up.I realy 
>>>      
>>>
>>need to now 
>>    
>>
>>>how Tomcat handles request and issues those request ,this is in 
>>>connection with threading. I have thought about the single 
>>>      
>>>
>>thread model
>>    
>>
>>> in my servlets but I think this is an inefficient method to use.
>>>
>>>Thanks
>>>Kwiri
>>>
>>>
>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>>      
>>>
>>
>>
>>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: tomcat-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>  
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message