This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Servlets and the fly likes Servlet HttpRequest processing thread Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet HttpRequest processing thread" Watch "Servlet HttpRequest processing thread" New topic

Servlet HttpRequest processing thread

apurav chauhan

Joined: Aug 07, 2010
Posts: 21
If i start a new thread in servlet doget() method to do some task asynchronously, will that return the current httprequest processing thread into the server's pool or will it depend on the child thread ?
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 12675
If you start a new Thread it will exist independently of the container Thread pool unless you deliberately program otherwise.

There is no such relationship as a "child" Thread - see the java.lang.Thread Javadocs.


Java Resources at
Ram Narayan.M
Ranch Hand

Joined: Jul 11, 2010
Posts: 247

Even a new thread is spawned from doGet(),

Request Processing Thread and newly spawned thread will run in "parallel"...

If task in servlet method is done, Request Processing Thread will be returned to the pool, while spawned thread would be executing.

It all depends upon how the thread is managed...

If you use join() method in doGet(), makes Request processing thread to wait until newly spawned thread completes its execution...

SCJP 6 [SCJP - Old is Gold]
I agree. Here's the link:
subject: Servlet HttpRequest processing thread
Similar Threads
Servlets and Threading
Calling another servlet from the current servlet?
Integarting existing jsps and Servlets Web Application with Spring 3.0
HttpServlet Request and Response objects creation
when init() method is called ?