Meaningless Drivel is fun!*
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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Threads & Instances" Watch "Threads & Instances" New topic

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="" target="_blank" rel="nofollow"></a><br /><a href="" target="_blank" rel="nofollow"></a><br /><a href="" target="_blank" rel="nofollow"></a>
Idly Vada
Ranch Hand

Joined: Sep 02, 2003
Posts: 135
I think you should read about processes and threads.
Sun tutorial at
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.
I agree. Here's the link:
subject: Threads & Instances
Similar Threads
NX: static RandomAccessFile?
Thread B has to start after completion of 5 instances of Thread A
when not to use thread
NX:(contractor)multi-threads functionally
Why would the container create more instances of the same MDB