1

I heard that Tomcat support servlet 3.0 and thread per request. And I don't experiment like this: Servlet seems to handle multiple concurrent browser requests synchronously

I expected that Thread.sleep wouldn't block other requests even made from the same browser window, but it does. The output is still not in concurrent way.

So how to configure Tomcat 7 support thread per request?

Community
  • 1
  • 1
kakacii
  • 728
  • 3
  • 10
  • 24

1 Answers1

1

You're fighting against HTTP keep-alive here. Your browser and Tomcat will act to conserve TCP connections and send multiple requests over a single connection. But why would you sleep in a request thread at all? The server is supposed to service requests, not go to sleep.

user207421
  • 305,947
  • 44
  • 307
  • 483
  • Sleeping in a request was meant to mock blocking io. (btw is sleeping works the same way as IO operation?) But yeah, I got myself confused. It's nothing to do with servlet 3.0 async io nor thread per request. It's just HTTP 1.1 keep-alive. – kakacii Aug 24 '13 at 11:54