aspose file tools*
The moose likes Servlets and the fly likes SingleThread Model is deprecated in 2.4 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "SingleThread Model is deprecated in 2.4" Watch "SingleThread Model is deprecated in 2.4" New topic
Author

SingleThread Model is deprecated in 2.4

Malli Raman
Ranch Hand

Joined: Nov 07, 2001
Posts: 312
Hi,
1) What is the advantages/disadvantages of using Single Thread Model.
- I feel instead of implementing SingleThreadModel we can put the particular codes in the synchroized block, which avoids the overhead. Am I correct?
2) What is the advantages of using Instance pooling model instead of single instance request model?
3) Since SingleThreadModel is deprecated then whether Servlet instance pooling model is still available? If so how to configure instance pooling in the weblogic server.
Thanks & Regards,
M.S.Raman.
praveenkumar singamsetty
Greenhorn

Joined: Oct 29, 2003
Posts: 6
Hi...this is what was written in java.sun.com
RonCrawford_II: Why is the SingleThreadModel interface and option in JSP when the Java platform offers the synchronized keyword? What are the benefits of placing synchronization on the JSP engine?
Marty: Well, SingleThreadModel gives the server more flexibility than you would have if you manually synchronized all your code in service or _jspService. For example, a server can queue up requests to a single servlet instance or make multiple servlet instances and send requests concurrently (as long as a single instance gets only one request at a time). That all being said, I do agree that in general it is better NOT to use SingleThreadModel and to synchronize access to shared data yourself.

bye dude
Andres Gonzalez
Ranch Hand

Joined: Nov 27, 2001
Posts: 1561
1) What is the advantages/disadvantages of using Single Thread Model.
I can't see any advantage. Disadvantage, many. The main one, performance.
- I feel instead of implementing SingleThreadModel we can put the particular codes in the synchroized block, which avoids the overhead. Am I correct?
hmmm yes. But it also depends on what exactly you want to sinchronize. For instance, it doesn't make sense to synchronize the service() method.
2) What is the advantages of using Instance pooling model instead of single instance request model?
what is "instance pooling model?". If your talking about SingleThreadModel, then the container may create several servlet instances and each thread will execute on its own instance.
3) Since SingleThreadModel is deprecated then whether Servlet instance pooling model is still available? If so how to configure instance pooling in the weblogic server.
SingleThreadModel is deprecated in servlet 2.4 only. I'm not sure whether there are servlet containers that create multiple instances of a servlet when running with multithread model. You shouldn't configure instance pooling, I think that's the container's job. Your job is to make sure that the servlet is thread safe, without the need of implementing SingleThreadModel (using local variables, avoiding static variables, etc).
hope this helps


I'm not going to be a Rock Star. I'm going to be a LEGEND! --Freddie Mercury
Malli Raman
Ranch Hand

Joined: Nov 07, 2001
Posts: 312
Originally posted by Andres Gonzalez:
1) What is the advantages/disadvantages of using Single Thread Model.
I can't see any advantage. Disadvantage, many. The main one, performance.
- I feel instead of implementing SingleThreadModel we can put the particular codes in the synchroized block, which avoids the overhead. Am I correct?
hmmm yes. But it also depends on what exactly you want to sinchronize. For instance, it doesn't make sense to synchronize the service() method.
2) What is the advantages of using Instance pooling model instead of single instance request model?
what is "instance pooling model?". If your talking about SingleThreadModel, then the container may create several servlet instances and each thread will execute on its own instance.
3) Since SingleThreadModel is deprecated then whether Servlet instance pooling model is still available? If so how to configure instance pooling in the weblogic server.
SingleThreadModel is deprecated in servlet 2.4 only. I'm not sure whether there are servlet containers that create multiple instances of a servlet when running with multithread model. You shouldn't configure instance pooling, I think that's the container's job. Your job is to make sure that the servlet is thread safe, without the need of implementing SingleThreadModel (using local variables, avoiding static variables, etc).
hope this helps

Thanks praveenkumar singamsetty , Andres Gonzalez.
Regards,
M.S.Raman
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SingleThread Model is deprecated in 2.4