Solved

About thread of servlet instance

Posted on 2006-10-29
5
249 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Scam emails are a huge burden for many businesses. Spotting one is not always easy. Follow our tips to identify if an email you receive is a scam.
Find out what Office 365 Transport Rules are, how they work and their limitations managing Office 365 signatures.
This video discusses moving either the default database or any database to a new volume.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

705 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

17 Experts available now in Live!

Get 1:1 Help Now