> It worked.  Now I had 3 web browsers loaded on my machine and added
> different values to each text box (one per web page).  I then executed the
3
> Web Pages at the same time.  Well! the results were different! Sometimes
all
> pages showed the same result and sometimes 2 would etc...  It took me a
> while to understand what had happened;

It is sometimes really frustating to debug the bugs introduced due to
multithreading. You had more than one thread executing through your sevlet
and that is what caused the problem.


> I believe that you should not declare
> objects that will have dynamic data outside of the method that is using
> them.

I don't think this is correct. Member variables are used for storing
attributes of classes and the attributes of course can be dynamic in nature.
The problem that you faced was due to fact that multiple threads were
executing the same method and hence accessing the same variable
simultaneously and resulting in inconsistent results. The change to local
variable in the method resulted in each thread having its own copy of the
variable and hence the problems disappeared.


regds,
Gokul

> Best Regards
>
>
> Marc

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to