Is there a way I can set my servlets to do thread pooling?

Alex Chaffee

Not really. You shouldn't be concerned about thread management when writing a servlet. Leave that up to the servlet engine. It may be using techniques like thread pooling, load balancing, and activation/passivation strategies to optimize performance. In fact, most EJB servers do use thread pooling "behind the scenes." All you need to worry about as a servlet author is that your servlets are thread-safe. See this FAQ for more details on thread safety and servlets.

If you want to spawn threads on your own, say to run a chat server, you may use thread pooling, but make sure you understand the interaction with the servlet engine.