How to find which thread currently has the lock in java

advertisements

I have a synchronized method in a singleton class which is called by many threads simultaneously. Is there any java API available to check which thread is currently owning the lock ?


You could perhaps print out Thread.currentThread() in your synchronized method.