This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes Servlets and the fly likes synchronization of servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "synchronization of servlet" Watch "synchronization of servlet" New topic

synchronization of servlet

anish jain
Ranch Hand

Joined: Feb 03, 2010
Posts: 129
Please tell me the difference between synchronizing the service or doget or dopost methods and implementing SingleThreadModel
Which one is better?
I tried to google it but couldn't get the satisfactory answer?
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42956
They amount to the same thing - and both are awful; don't do either. Java has so many synchronization and concurrency features by now that destroying concurrency for all clients -which is what those two approaches do- is not necessary.
Kris Schneider
Ranch Hand

Joined: Feb 14, 2001
Posts: 71
There can be some fairly significant differences, like allowed servlet instance pooling, but SingleThreadModel was deprecated in Servlet 2.4...
It is sorta covered in the JavaRanch Style Guide.
subject: synchronization of servlet
It's not a secret anymore!