Julio Gutierrez

Greenhorn
+ Follow
since Oct 26, 2013
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Julio Gutierrez

Jaikiran, thanks a lot

Taking a look at the discussion you mentioned, is the same issue, but i don't really think to the problem is firefox, i'm using chrome and seems like if you sent the exact same request, the container reuse the request and process it one after the other or something like that.

So anyways in order to actually see the same servlet running on diferent threads at the same time i changed the following:



to:



and bam! it works as charm.

Thanks everyone!
10 years ago

Bear Bibeault wrote:The servlet container handles running the threads. You should not be trying to create your own threads in the servlet.



i'm not creating the thread in the servlet, take a look at the class, i'm just printing out the used thread
10 years ago
Hi There!

I'm doing some silly exercises in order to get ready for OCPWCD, anyways according to the theory, the same servlet, should run on different threads on per request, so i did a simple example:



and then i just call the servlet multiple times, and bam! every request runs one after the other on the same thread.

if you want to see it on action you can download the entire repo git@github.com:bubuntux/OCPWCD.git (is pretty small), then mvn tomcat6:run, then open http://localhost:8080/chapter4/index.html and click on SameServletMultipleThreads link.

Perhaps i'm missing a tomcat config? not really sure why this servlet is not running on different threads at the same time.

any idea??

thanks!
10 years ago