printWriter.append("Write-Locked: " + (lock.isWriteLocked() ? "YES" : "NO"));
printWriter.append("\n");
printWriter.append("Has queued threads: " + (lock.hasQueuedThreads() ? "YES" : "NO"));
printWriter.append("\n");
if (readLockCount > 0 && lock instanceof ReentrantReadWriteLockTracker) {
ReentrantReadWriteLockTracker debugLock = (ReentrantReadWriteLockTracker) lock;
printWriter.append("Threads holding read-lock: \n");
Set<ReadLockDebug> lockedReadLocks = debugLock.getLockedReadLocks();
for (ReadLockDebug readLockDebug : lockedReadLocks) {
printStackTrace(readLockDebug.getStackTrace(), printWriter);
printWriter.append("\n");
}
printWriter.append("\n");
}
if (lock.isWriteLocked() && lock instanceof ReentrantReadWriteLockTracker) {
ReentrantReadWriteLockTracker debugLock = (ReentrantReadWriteLockTracker) lock;
printWriter.append("Thread holding write-lock: \n");
printStackTrace(debugLock.writeLock().getStackTrace(), printWriter);
printWriter.append("\n");
}
printWriter.append("Queue length: " + lock.getQueueLength());
printWriter.append("\n");
printWriter.append("Queued threads: ");