This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Servlets and the fly likes Threads & Instances Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Threads & Instances" Watch "Threads & Instances" New topic
Author

Threads & Instances

varun bihani
Ranch Hand

Joined: Aug 11, 2003
Posts: 96
I have a very general question as i am a neophyte in java.
I want to know what is difference between instances and threads in servlets/jsp.
I want to know how does servlet handled multiple requests(simultaneous).


<a href="http://www.galaxyweblinks.com" target="_blank" rel="nofollow">www.galaxyweblinks.com</a><br /><a href="http://www.freechatcode.com" target="_blank" rel="nofollow">www.freechatcode.com</a><br /><a href="http://www.onlinefamilytreemaker.com" target="_blank" rel="nofollow">www.onlinefamilytreemaker.com</a>
Idly Vada
Ranch Hand

Joined: Sep 02, 2003
Posts: 135
I think you should read about processes and threads.
Sun tutorial at
http://java.sun.com/docs/books/tutorial/essential/threads/
may help you.

If you use SingleThreadModel for a servlet, an instance of servlet is created for each request.
Ohterwise, a new thread is created for each request.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Threads & Instances