Solved

About thread of servlet instance

Posted on 2006-10-29
5
255 Views
Last Modified: 2010-04-01
According to my understanding, the system makes a single instance of our servlet and then creates a new thread for each user request.
When the a specific request is completed, will the thread that handle that request being deleted? Why?
0
Comment
Question by:william007
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 9

Author Comment

by:william007
ID: 17830323
Hi, thanks for posting so many links, but I just want to know will the thread being deleted when the request ended or it will be continue there for use by the other request?
0
 
LVL 10

Assisted Solution

by:jaggernat
jaggernat earned 100 total points
ID: 17831192
Once the request ends, the servlet assigns the thread to process the next request.
When a system removes a servlet, it runs the servlet's destroy method. However, When the destroy method runs,  other threads might be processing service requests.
0
 
LVL 8

Accepted Solution

by:
reach2piyush earned 400 total points
ID: 17831576
- Thread handling is not a part of Servlet specifications, so the behaviour can vary for different Servers.

- Most Servers do maintain a pool of threads for the request, here is a excerpt from Tomcat documentation

At server startup time, this Connector will create a number of request processing threads (based on the value configured for the minProcessors attribute). Each incoming request requires a thread for the duration of that request. If more simultaneous requests are received than can be handled by the currently available request processing threads, additional threads will be created up to the configured maximum (the value of the maxProcessors attribute). If still more simultaneous requests are received, they are stacked up inside the server socket created by the Connector, up to the configured maximum (the value of the acceptCount attribute. Any further simultaneous requests will receive "connection refused" errors, until resources are available to process them.

From: http://tomcat.apache.org/tomcat-4.1-doc/config/coyote.html
0
 
LVL 9

Author Comment

by:william007
ID: 17853555
Thanks=)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why do some people recommend buying business VoIP from an ISP? What are the benefits to my company? What are the costs?
This article is written by John Gates, CISSP. Gates, the SNUG President-Elect, currently holds the position of Manager of Information Systems at Lake Park High School in Roselle, Illinois.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question