• Post Reply Bookmark Topic Watch Topic
  • New Topic

Synchronized block Vs Concurrent Lock  RSS feed

 
kri shan
Ranch Hand
Posts: 1489
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which gives best performance Synchronized block / Concurrent Lock ?
 
Winston Gutkowski
Bartender
Posts: 10573
65
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!