File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet HttpRequest processing thread

 
apurav chauhan
Greenhorn
Posts: 21
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 13045
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Bill
 
Ram Narayan.M
Ranch Hand
Posts: 247
Chrome Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic