• Post Reply Bookmark Topic Watch Topic
  • New Topic

Synchronized methods  RSS feed

 
Aruna Balasuriya
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are there any plus points(meaningful) in synchronizing a static metod ???
 
Campbell Ritchie
Marshal
Posts: 56529
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If there is any chance of non-atomically changing the value of a static variable, then you would need synchronization or locks or similar.
 
Paul Clapham
Sheriff
Posts: 22823
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Alternatively, the fact that a method is static is not relevant to the decision to synchronize it. The decision should be based on what the method does.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!