This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
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


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "About servlet Watch "About servlet New topic
Author

About servlet's service() method synchronize

Raj chiru
Ranch Hand

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

Joined: Aug 03, 2008
Posts: 9280
    
  17

Yes you can...


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

Joined: Jan 10, 2002
Posts: 60071
    
  65

But doing so would not be wise.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
sc ghosh
Greenhorn

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
Bartender

Joined: Apr 14, 2004
Posts: 10336

"java ninja", please check your private messages.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: About servlet's service() method synchronize
 
Similar Threads
Did implicit objects are instance variables or local variables in _jspService
Post to Servlet from Applet doesn't work
servlets
Web service method call behaviour?
protected Method service???