• Post Reply Bookmark Topic Watch Topic
  • New Topic

synchronized method blocks acessing non-sync blocks  RSS feed

 
Rahul Mahindrakar
Ranch Hand
Posts: 1869
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could anyone please clarify on the statement below
"If a synchronized method calls a non-synchronized instance method to modify and object, it is thread safe. This is because a non-synchronized method becomes synchronized when it is called from a synchronized method. "
I got this however
"If a synchronized method directly modifies objects that are part of the private instance data of a method's class the code is not thread safe."
------------------
Regds.
Rahul P. Mahindrakar
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!