| Author |
Is My servlet really multithreaded
|
Andrej Bruno
Greenhorn
Joined: Apr 09, 2008
Posts: 2
|
|
hi i have wrote a little servlet which reacts on zthe method DoGet(). I have coded it that way, that the client/browser sends via GET the parameter time=XXX. here, I define the time, the servlet should wait till it response with some text. I did this because I wanted to test if my servlet is really multithreading, but it seems thats not that way. My Test: I started 1 browser requesting my servlet with the parameter ?time=20 and another browser with time=2 and I started the second request directly after the first one. But my problem is, that the second request with time=2 gets his response after the first request gets his response after 22 seconds. Why is it that way. I thought that the servlet automatically starts a new thread. shouldnt the seconds request with time=2 gets his responds first??? my servlet is behind a tomcat server. Shall I configure the tomcat server a bit???
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
Yes, servlets are threaded. It's possible that your browser is making the requests synchronously. Try opening two different browser intances (firefox and MSIE for example) and see what happens.
|
Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
|
 |
Andrej Bruno
Greenhorn
Joined: Apr 09, 2008
Posts: 2
|
|
thank you you are completely right! with mozilla and IE it works parallel thank you, what a mistake
|
 |
 |
|
|
subject: Is My servlet really multithreaded
|
|
|