File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Thread pool of servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Thread pool of servlet" Watch "Thread pool of servlet" New topic

Thread pool of servlet

Hariom Tiwari

Joined: Jun 15, 2008
Posts: 10
Is there any way to set Thread pool size for a particular/general servlet?
Steve Luke

Joined: Jan 28, 2003
Posts: 4181

Probably not. This would generally be server dependent. On some servers you would be able to control the total number of simultaneous requests - which would define the thread pool size, or vice versa. But I don't know any that control how many threads can access a single Servlet.

Why do you want to do this?

Hussein Baghdadi
clojure forum advocate

Joined: Nov 08, 2003
Posts: 3479

I'm not sure but it looks to me as an application-specific issue.
AFAIK, JEE specification doesn't indicate such a thing.
Hariom Tiwari

Joined: Jun 15, 2008
Posts: 10
just out of curiousity.
I guess there needs to be any such mechanism.In case thousands of requests come for a particular servlet ,wont performance drgrade?
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13024
There is a mechanism limiting the number of "simultaneous" requests but it is for the servlet container as a whole.

Think about it - the container has to take a request and examine it before it knows which servlet will process it.

Inside the servlet, you can control the number of requests actually being worked on by rejecting excess requests with some sort of message.

I agree. Here's the link:
subject: Thread pool of servlet
It's not a secret anymore!