• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is My servlet really multithreaded

 
Andrej Bruno
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Andrej Bruno
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you

you are completely right!
with mozilla and IE it works parallel

thank you, what a mistake
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic