I realise part of my mistake is using global variables ,unsynchronized collections and unsynchronized code blocks.I am not using the single thread model.
My initial thought ( :-) forgive me its some time since I have coded servlets) was that Tomcat will create a new servlet instance that is totally independed of the other, for each request.On testing the app on two client machines I have realized that the data is corrupted all mixed up and my velocity template is throwing an error caused by concurrent modification.
My question is there some way of making this app thread safe and also how does Tomcat actually many requests , in terms of the threading method used?I am using Tomcat 4.1
Shapira, Yoav wrote:
Howdy, State your specific requirements and we can help you design servlets/objects that will meet those requirements. Your original post is too broad to solicit a detailed response.
Yoav Shapira Millennium ChemInformatics
to-----Original Message----- From: kwirirai [mailto:[EMAIL PROTECTED] Sent: Monday, February 09, 2004 12:48 PM To: [EMAIL PROTECTED] 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
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]