Solved

About thread of servlet instance

Posted on 2006-10-29
5
250 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
  • 2
  • 2
5 Comments
 
LVL 10

Expert Comment

by:jaggernat
ID: 17829368
0
 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Note: This is the second blog post in a series on email clearinghouses (https://www.xmatters.com/alert-management/blog-email-has-failed-us?utm_campaign=70138000000ydLoAAI&utm_source=exex&utm_medium=article&utm_content=blog-post).   Every month t…
Knowledge base software has turned out to be a quite reliable method for storing information, promoting collaborative work and for sharing valuable input and solutions.However, some organizations are trying to develop a knowledge base that works wit…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

863 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now