Can several threads hold a lock on the same monitor in Java?

和自甴很熟 提交于 2019-12-01 06:53:04

It looks like all these threads are waiting for condition associated with the monitor, i.e. they called wait() method of that monitor.

When thread calls wait() on the monitor it owns, it temporary releases the monitor and need to reacquire it when returning from wait(). So, you can have multiple threads that used to own a monitor but now are waiting in wait() method.

What means "- locked <0x00007f847612c820> (a com.tc.object.RemoteObjectManagerImpl)".

It means its inside the synchronized block for that lock. It can be with WAITING (in which case another thread can acquire/hold the lock, or RUNNING in which case it is holding the lock.

Those threads are waiting to get the lock, not holding the lock.

No different threads cannot hold a lock on the same objects. Somebody else holds the lock and all the threads in the dump are waiting on that lock.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!