Hi everybody,
In this context, I want to share my experience with similar (but may not be
same) problem.
I have a simple html form submitting login name and password to a simple
servlet. The servlet validates the password and tells the user whether he is
logged in or not.
When I open 4 browser windows (all of IE 5.0 on same m/c) and submit the
parameters at the SAME time, three browser windows are blank (no response
info is displayed in them) and one browser window displays four messages
corresponding to all four attempts to login.
Can we related this behaviour related to what has been discussed here ? But,
we do not have any 'dynamically' changing variable defined out side the
doPost method!. All the servlet does is to respond to the client with
relevant info whether the user is logged-in or not !
Can some body please explain this behaviour ?
regards,
Bhaskar Varanasi
IIC Technologies Pvt. Ltd.,
Hyderabad.
http://www.iictechnologies.com
Alternate e-mail :
[EMAIL PROTECTED]
[EMAIL PROTECTED]
-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of Gokul
Singh
Sent: Thursday, October 12, 2000 1:57 PM
To: [EMAIL PROTECTED]
Subject: Re: A question about the fundamentals!
> 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
___________________________________________________________________________
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