• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Synchronized block Vs Concurrent Lock

 
kri shan
Ranch Hand
Posts: 1467
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which gives best performance Synchronized block / Concurrent Lock ?
 
Winston Gutkowski
Bartender
Pie
Posts: 10422
63
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic