A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Servlet HttpRequest processing thread
Joined: Aug 07, 2010
Sep 17, 2011 13:24:16
If i start a new thread in
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 ?
Author and all-around good cowpoke
Joined: Mar 22, 2000
Sep 17, 2011 14:16:44
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.
Joined: Jul 11, 2010
Sep 17, 2011 14:19:52
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
Servlets and Threading
when init() method is called ?
Calling another servlet from the current servlet?
HttpServlet Request and Response objects creation
Integarting existing jsps and Servlets Web Application with Spring 3.0
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014