• Post Reply Bookmark Topic Watch Topic
  • New Topic

Syncronization

 
pankaj semwal
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All[],


If i made synchronize to block and method.Which will access
first by thread whether synchronize block or synchronize method.and why


Thanks
 
Henry Wong
author
Sheriff
Posts: 22542
109
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no defined ordering. If a synchronized block and a synchronized method are both contending for the same lock, then who gets it first depends on the underlying OS implementation. Java doesn't define an ordering.

Henry
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!