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?

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

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.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.