Meaningless Drivel is fun!
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 OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 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: 42958
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...
I agree. Here's the link:
subject: synchronization of servlet
It's not a secret anymore!