aspose 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


Win a copy of Java 8 in Action this week in the Java 8 forum!
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: 1368
Which gives best performance Synchronized block / Concurrent Lock ?
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 7081
    
  16

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Synchronized block Vs Concurrent Lock
 
Similar Threads
exception in sync block
Synchronizing Code
synchronized and ReentrantReadWriteLock
Synchronized method and Sychronized block
synchronized