File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Performance and the fly likes Synchronized block Vs Concurrent Lock Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Performance
Bookmark "Synchronized block Vs Concurrent Lock" Watch "Synchronized block Vs Concurrent Lock" New topic
Author

Synchronized block Vs Concurrent Lock

kri shan
Ranch Hand

Joined: Apr 08, 2004
Posts: 1372
Which gives best performance Synchronized block / Concurrent Lock ?
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 7700
    
  20

kri shan wrote:Which gives best performance Synchronized block / Concurrent Lock ?

In theory, the latter is supposed to be more scalable, and does allow a bit more flexibility; but it comes at the expense of more code and thus more chances for "getting it wrong" and/or making things less readable.

Unless you're actually writing a critical multi-tasking system, I'd suggest you only use the latter if you can prove that it makes sense. And that means LOTS of testing of both forms.

Winston
 
wood burning stoves
 
subject: Synchronized block Vs Concurrent Lock