Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

synchronized methods

 
Sasikanth Malladi
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All, if a synchronized method calls a non synchronized one, I think the guarantee of only thread accessing the method won't extend to the non-synchronized one. Am I right?
TIA,
Sashi
 
Keith Lynn
Ranch Hand
Posts: 2409
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are scenarios where you could have multiple threads access the unsynchronized methods, but no other thread would use the unsynchronized method from within the synchronized method until it obtained a lock on the object.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic