Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Single-Thread vs. Multithreaded Servlets

Status
Not open for further replies.

cpope

Programmer
Jul 7, 2000
58
US
Can anyone explain an example of when a single threaded servlet should be used as opposed to the default multi-threaded servlet?

 
Single-threaded mode should be used when you want to insure that no more than one request will be processed by the servlet at any one time. Using Single-threaded mode relieves you of the duty of being a good programmer and making sure your Servlet is thread-safe. I can't think of any situation that would require this type of behavior. In 99% of all cases you should take the necessary precautions and insure your servlet functions correctly in multi-threaded mode. This means not using class instance variables to store results and other such precautions.

Oh yeah, single-threaded mode also serves to significantly decrease your performance. Wushutwist
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top