You can use JMX classes to check threads:
ThreadInfo[] infos = ManagementFactory.getThreadMXBean().dumpAllThreads(true, true);
Each blocked thread has an associated non-zero LockInfo , which will allow you to determine on which object it is waiting:
for (ThreadInfo info : infos) { LockInfo lockInfo = info.getLockInfo(); if (lockInfo != null && lockInfo.getClassName().equals(lock.getClass().getName()) && lockInfo.getIdentityHashCode() == System.identityHashCode(lock)) { System.out.println("Thread waiting on " + lock + " : " + info.getThreadName()); } }
source share