File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes About servlet's service() method synchronize Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "About servlet Watch "About servlet New topic

About servlet's service() method synchronize

Raj chiru
Ranch Hand

Joined: Aug 12, 2008
Posts: 142
Q: can we make the service() method synchronized?
Ankit Garg

Joined: Aug 03, 2008
Posts: 9465

Yes you can...

SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63866

But doing so would not be wise.

[Asking smart questions] [About Bear] [Books by Bear]
sc ghosh

Joined: Mar 16, 2009
Posts: 1
Yes you can do that...... but essentially you would spoil the advantage of servlets then............ it would mean that the servlet would fail to handle multiple client requests at the same time............. it would just be like implementing the SingleThread model.............. you should refrain from doing this................
Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

"java ninja", please check your private messages.

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
I agree. Here's the link:
subject: About servlet's service() method synchronize
It's not a secret anymore!