static synchronized and non static synchronized methods in threads difference in behavior

Viewed 69

I understand that static synchronized lock on Class objects, and non static locks on Object instance.

However in the accepted answer for this question: Static versus non-static lock object in synchronized block

When you use a non-static lock object:

  • thread 1 calls o1.foo()
  • thread 2 calls o1.foo(), will have to wait for thread 1 to finish
  • thread 3 calls o2.foo(), it can just continue, not minding thread 1 and 2

Why can Thread 3 just continue without regarding thread 1 and 2. Shouldnt Thread 3 have to wait to acquire the lock on the Object instance 'this' from either thread 1 or 2 before it can proceed ?

1 Answers
Related