List of usage examples for java.lang.management LockInfo toString
public String toString()
From source file:com.workplacesystems.utilsj.ThreadDumperJdk16.java
@Override void outputLockedSynchronizers(ThreadInfo info, ExtraLockInfo exLockInfo, StringBuffer buffer) { List<LockInfo> locked_synchronizers = Arrays.asList(info.getLockedSynchronizers()); if (!locked_synchronizers.isEmpty() || (exLockInfo != null && exLockInfo.hasHeldLocks())) { buffer.append(" Locked Synchronizers:\n"); ArrayList<String> reportedSyncs = new ArrayList<String>(); for (LockInfo lockInfo : locked_synchronizers) { reportedSyncs.add(lockInfo.toString()); formatLock(lockInfo, null, buffer); if (exLockInfo != null) { if (exLockInfo.heldWritesContains(lockInfo)) buffer.append(" for write"); if (exLockInfo.heldReadsContains(lockInfo)) buffer.append(" for read"); }// w w w .j a v a 2s .c o m buffer.append("\n"); } if (exLockInfo != null) { for (LockInfo writeLock : exLockInfo.getHeldWriteLocks()) { if (!reportedSyncs.contains(writeLock.toString())) { formatLock(writeLock, null, buffer); buffer.append(" for write\n"); } } for (LockInfo readLock : exLockInfo.getHeldReadLocks()) { if (!reportedSyncs.contains(readLock.toString())) { formatLock(readLock, null, buffer); buffer.append(" for read\n"); } } } buffer.append("\n"); } }