0

Say some thread has acquired an object A's lock and is now executing that object's synchronized method. Within that method there is a call on some object B's synchronized method and thread is blocked while trying to acquire that object B's lock.

Does object A's lock is released while thread is waiting on object B's lock?
Can such a scenario cause issues in a multi-threading design?

lionHeart
  • 507
  • 5
  • 14

1 Answers1

1

No, object A will remain locked.

And it can lead to deadlock if other thread locks B first and tries to lock A.

Michael Nastenko
  • 2,785
  • 1
  • 10
  • 14
  • Thank you Michael. Now I am positive that such a scenario created some issues in my code but strangely, I couldn't find the answer to this question online... – lionHeart Nov 08 '15 at 14:20