aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Multithreaded and SingleThreadModel Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Multithreaded and SingleThreadModel" Watch "Multithreaded and SingleThreadModel" New topic
Author

Multithreaded and SingleThreadModel

Jack Lau
Ranch Hand

Joined: Aug 30, 2002
Posts: 166
Hello All,

Since servlet by default is using multithread, multiple threads can access same servlet simutanously. Is there only one instance of each servlet (e.g. servletA) exists in the servlet container?

Also if implements SingleThreadModel, does it create more than one servlet (e.g. servletA) if there are more than 1 request?

Thanks,
Jack
Mikalai Zaikin
Ranch Hand

Joined: Jun 04, 2002
Posts: 3204
    
    5
Hi Jack ,

Yes, by default only 1 instance of each Servlet exists in Servlet Container and serves multiple threads simultaneously.

If SingleThreadModel implemented, there are 2 options:
1) create pool of servlet instances and pass new request to new instance
2) serialize incoming request and put it in the queue to one servlet instance

1), or 2) - depends on servlet container implementation.

regards,
MZ


Free SCDJWS 5.0 Study Guide - SCDJWS 5.0 Quiz (How to get SCDJWS 5.0 Quiz)
Java Platform, Enterprise Edition 6 Web Services Developer Certified Expert Exam Study Guide and Quiz
Jack Lau
Ranch Hand

Joined: Aug 30, 2002
Posts: 166
Thank you!
Jack
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Multithreaded and SingleThreadModel