Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

doubt in synchronization

 
manas ranjan mandal
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is the difference between syncronize a block and synchronize an entire method?
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by manas ranjan mandal:
what is the difference between syncronize a block and synchronize an entire method?


Difference is the object on which it is synchronized.
In a sync block you specify the object you want to synchronize upon.
A synchronize instance method synchronize on "this"
A synchronize static method synchronize on "class" static member variable present for every class.
 
Space pants. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!