Java Code Examples for java.lang.management.MonitorInfo#getLockedStackDepth()

The following examples show how to use java.lang.management.MonitorInfo#getLockedStackDepth() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ThreadMonitor.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private void printThreadInfo(ThreadInfo ti) {
   // print thread information
   printThread(ti);

   // print stack trace with locks
   StackTraceElement[] stacktrace = ti.getStackTrace();
   MonitorInfo[] monitors = ti.getLockedMonitors();
   for (int i = 0; i < stacktrace.length; i++) {
       StackTraceElement ste = stacktrace[i];
       System.out.println(INDENT + "at " + ste.toString());
       for (MonitorInfo mi : monitors) {
           if (mi.getLockedStackDepth() == i) {
               System.out.println(INDENT + "  - locked " + mi);
           }
       }
   }
   System.out.println();
}
 
Example 2
Source File: TimedOutTestsListener.java    From hbase with Apache License 2.0 6 votes vote down vote up
private static void printThreadInfo(ThreadInfo ti, PrintWriter out) {
  // print thread information
  printThread(ti, out);

  // print stack trace with locks
  StackTraceElement[] stacktrace = ti.getStackTrace();
  MonitorInfo[] monitors = ti.getLockedMonitors();
  for (int i = 0; i < stacktrace.length; i++) {
    StackTraceElement ste = stacktrace[i];
    out.println(INDENT + "at " + ste.toString());
    for (MonitorInfo mi : monitors) {
      if (mi.getLockedStackDepth() == i) {
        out.println(INDENT + "  - locked " + mi);
      }
    }
  }
  out.println();
}
 
Example 3
Source File: ThreadMonitor.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private void printThreadInfo(ThreadInfo ti) {
   // print thread information
   printThread(ti);

   // print stack trace with locks
   StackTraceElement[] stacktrace = ti.getStackTrace();
   MonitorInfo[] monitors = ti.getLockedMonitors();
   for (int i = 0; i < stacktrace.length; i++) {
       StackTraceElement ste = stacktrace[i];
       System.out.println(INDENT + "at " + ste.toString());
       for (MonitorInfo mi : monitors) {
           if (mi.getLockedStackDepth() == i) {
               System.out.println(INDENT + "  - locked " + mi);
           }
       }
   }
   System.out.println();
}
 
Example 4
Source File: ThreadMonitor.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private void printThreadInfo(ThreadInfo ti) {
   // print thread information
   printThread(ti);

   // print stack trace with locks
   StackTraceElement[] stacktrace = ti.getStackTrace();
   MonitorInfo[] monitors = ti.getLockedMonitors();
   for (int i = 0; i < stacktrace.length; i++) {
       StackTraceElement ste = stacktrace[i];
       System.out.println(INDENT + "at " + ste.toString());
       for (MonitorInfo mi : monitors) {
           if (mi.getLockedStackDepth() == i) {
               System.out.println(INDENT + "  - locked " + mi);
           }
       }
   }
   System.out.println();
}
 
Example 5
Source File: MBeanDumper.java    From tda with GNU Lesser General Public License v2.1 6 votes vote down vote up
private void printThreadInfo(ThreadInfo ti, StringBuilder dump) {
   // print thread information
   printThread(ti, dump);

   // print stack trace with locks
   StackTraceElement[] stacktrace = ti.getStackTrace();
   MonitorInfo[] monitors = ti.getLockedMonitors();
   for (int i = 0; i < stacktrace.length; i++) {
       StackTraceElement ste = stacktrace[i];
       dump.append(INDENT + "at " + ste.toString());
       dump.append("\n");
       for (int j = 1; j < monitors.length; j++) {
           MonitorInfo mi = monitors[j];
           if (mi.getLockedStackDepth() == i) {
               dump.append(INDENT + "  - locked " + mi);
               dump.append("\n");
           }
       }
   }
   dump.append("\n");
}
 
Example 6
Source File: CurrentRequestsHandler.java    From styx with Apache License 2.0 6 votes vote down vote up
private String getThreadElements(ThreadInfo t) {
    StackTraceElement[] elements = t.getStackTrace();
    MonitorInfo[] monitors = t.getLockedMonitors();

    StringBuilder sb = new StringBuilder();

    for (int i = 0; i < elements.length; i++) {
        StackTraceElement element = elements[i];
        sb.append(format("    at %s%n", element));
        for (int j = 1; j < monitors.length; j++) {
            MonitorInfo monitor = monitors[j];
            if (monitor.getLockedStackDepth() == i) {
                sb.append(format("      - locked %s%n", monitor));
            }
        }
    }

    return sb.toString();
}
 
Example 7
Source File: Detector.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void printThreadInfo(ThreadInfo ti, PrintStream out) {
   printThread(ti, out);

   // print stack trace with locks
   StackTraceElement[] stacktrace = ti.getStackTrace();
   MonitorInfo[] monitors = ti.getLockedMonitors();
   for (int i = 0; i < stacktrace.length; i++) {
       StackTraceElement ste = stacktrace[i];
       out.println(INDENT + "at " + ste.toString()); // NOI18N
       for (MonitorInfo mi : monitors) {
           if (mi.getLockedStackDepth() == i) {
               out.println(INDENT + "  - locked " + mi); // NOI18N
           }
       }
   }
   out.println();
}
 
Example 8
Source File: ThreadMonitor.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
private void printThreadInfo(ThreadInfo ti) {
   // print thread information
   printThread(ti);

   // print stack trace with locks
   StackTraceElement[] stacktrace = ti.getStackTrace();
   MonitorInfo[] monitors = ti.getLockedMonitors();
   for (int i = 0; i < stacktrace.length; i++) {
       StackTraceElement ste = stacktrace[i];
       System.out.println(INDENT + "at " + ste.toString());
       for (MonitorInfo mi : monitors) {
           if (mi.getLockedStackDepth() == i) {
               System.out.println(INDENT + "  - locked " + mi);
           }
       }
   }
   System.out.println();
}
 
Example 9
Source File: SampledCPUSnapshot.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
private void printMonitors(final StringBuilder sb, final MonitorInfo[] monitors, final int index) {
    if (monitors != null) {
        for (MonitorInfo mi : monitors) {
            if (mi.getLockedStackDepth() == index) {
                sb.append("\t- locked ");   // NOI18N
                printLock(sb,mi);
                sb.append("<br>");    // NOI18N
            }
        }
    }
}
 
Example 10
Source File: ThreadDumpWindow.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void printMonitors(final StringBuilder sb, final MonitorInfo[] monitors, final int index) {
    if (monitors != null) {
        for (MonitorInfo mi : monitors) {
            if (mi.getLockedStackDepth() == index) {
                sb.append("    - locked ");   // NOI18N
                printLock(sb, mi);
                sb.append("<br>");    // NOI18N
            }
        }
    }
}
 
Example 11
Source File: SampledCPUSnapshot.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void printMonitors(final StringBuilder sb, final MonitorInfo[] monitors, final int index) {
    if (monitors != null) {
        for (MonitorInfo mi : monitors) {
            if (mi.getLockedStackDepth() == index) {
                sb.append("\t- locked ");   // NOI18N
                printLock(sb,mi);
                sb.append("<br>");    // NOI18N
            }
        }
    }
}
 
Example 12
Source File: VisorThreadMonitorInfo.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 * Create data transfer object for given monitor info.
 *
 * @param mi Monitoring info.
 */
public VisorThreadMonitorInfo(MonitorInfo mi) {
    super(mi);

    stackDepth = mi.getLockedStackDepth();
    stackFrame = mi.getLockedStackFrame();
}
 
Example 13
Source File: JmxSupport.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
private void printMonitors(final StringBuilder sb, final MonitorInfo[] monitors, final int index) {
    if (monitors != null) {
        for (MonitorInfo mi : monitors) {
            if (mi.getLockedStackDepth() == index) {
                sb.append("\t- locked ");   // NOI18N
                printLock(sb,mi);
                sb.append("\n");    // NOI18N
            }
        }
    }
}
 
Example 14
Source File: AbstractContainer.java    From qpid-broker-j with Apache License 2.0 4 votes vote down vote up
private String getThreadStackTraces(final ThreadInfo threadInfo)
{
    String lineSeparator = System.lineSeparator();
    StringBuilder dump = new StringBuilder();
    dump.append("\"").append(threadInfo.getThreadName()).append("\"").append(" Id=")
        .append(threadInfo.getThreadId()).append( " ").append(threadInfo.getThreadState());
    if (threadInfo.getLockName() != null)
    {
        dump.append(" on ").append(threadInfo.getLockName());
    }
    if (threadInfo.getLockOwnerName() != null)
    {
        dump.append(" owned by \"").append(threadInfo.getLockOwnerName())
            .append("\" Id=").append(threadInfo.getLockOwnerId());
    }
    if (threadInfo.isSuspended())
    {
        dump.append(" (suspended)");
    }
    if (threadInfo.isInNative())
    {
        dump.append(" (in native)");
    }
    dump.append(lineSeparator);
    StackTraceElement[] stackTrace = threadInfo.getStackTrace();
    for (int i = 0; i < stackTrace.length; i++)
    {
        StackTraceElement stackTraceElement = stackTrace[i];
        dump.append("    at ").append(stackTraceElement.toString()).append(lineSeparator);

        LockInfo lockInfo = threadInfo.getLockInfo();
        if (i == 0 && lockInfo != null)
        {
            Thread.State threadState = threadInfo.getThreadState();
            switch (threadState)
            {
                case BLOCKED:
                    dump.append("    -  blocked on ").append(lockInfo).append(lineSeparator);
                    break;
                case WAITING:
                    dump.append("    -  waiting on ").append(lockInfo).append(lineSeparator);
                    break;
                case TIMED_WAITING:
                    dump.append("    -  waiting on ").append(lockInfo).append(lineSeparator);
                    break;
                default:
            }
        }

        for (MonitorInfo mi : threadInfo.getLockedMonitors())
        {
            if (mi.getLockedStackDepth() == i)
            {
                dump.append("    -  locked ").append(mi).append(lineSeparator);
            }
        }
    }

    LockInfo[] locks = threadInfo.getLockedSynchronizers();
    if (locks.length > 0)
    {
        dump.append(lineSeparator).append("    Number of locked synchronizers = ").append(locks.length);
        dump.append(lineSeparator);
        for (LockInfo li : locks)
        {
            dump.append("    - " + li);
            dump.append(lineSeparator);
        }
    }
    dump.append(lineSeparator);
    return dump.toString();
}
 
Example 15
Source File: DeadlockMonitorTask.java    From pinpoint with Apache License 2.0 4 votes vote down vote up
/**
 * refer to java.lang.management.ThreadInfo.toString {@link ThreadInfo}
 * To find loadClass cause. MAX_FRAME is too short , the length.
 */
private String createThreadDump(ThreadInfo threadInfo) {
    StringBuilder sb = new StringBuilder("\"" + threadInfo.getThreadName() + "\"" +
            " Id=" + threadInfo.getThreadId() + " " + threadInfo.getThreadState());
    if (threadInfo.getLockName() != null) {
        sb.append(" on " + threadInfo.getLockName());
    }
    if (threadInfo.getLockOwnerName() != null) {
        sb.append(" owned by \"" + threadInfo.getLockOwnerName() +
                "\" Id=" + threadInfo.getLockOwnerId());
    }
    if (threadInfo.isSuspended()) {
        sb.append(" (suspended)");
    }
    if (threadInfo.isInNative()) {
        sb.append(" (in native)");
    }
    sb.append('\n');

    StackTraceElement[] stackTrace = threadInfo.getStackTrace();
    for (int i = 0; i < stackTrace.length; i++) {
        StackTraceElement ste = stackTrace[i];
        sb.append("\tat " + ste.toString());
        sb.append('\n');
        if (i == 0 && threadInfo.getLockInfo() != null) {
            LockInfo lockInfo = threadInfo.getLockInfo();
            Thread.State ts = threadInfo.getThreadState();
            switch (ts) {
                case BLOCKED:
                    sb.append("\t-  blocked on " + lockInfo);
                    sb.append('\n');
                    break;
                case WAITING:
                    sb.append("\t-  waiting on " + lockInfo);
                    sb.append('\n');
                    break;
                case TIMED_WAITING:
                    sb.append("\t-  waiting on " + lockInfo);
                    sb.append('\n');
                    break;
                default:
            }
        }

        MonitorInfo[] lockedMonitors = threadInfo.getLockedMonitors();
        for (MonitorInfo mi : lockedMonitors) {
            if (mi.getLockedStackDepth() == i) {
                sb.append("\t-  locked " + mi);
                sb.append('\n');
            }
        }
    }

    LockInfo[] locks = threadInfo.getLockedSynchronizers();
    if (locks.length > 0) {
        sb.append("\n\tNumber of locked synchronizers = " + locks.length);
        sb.append('\n');
        for (LockInfo li : locks) {
            sb.append("\t- " + li);
            sb.append('\n');
        }
    }
    sb.append('\n');
    return sb.toString();
}
 
Example 16
Source File: ThreadUtil.java    From samza with Apache License 2.0 4 votes vote down vote up
/**
 * Copy of ThreadInfo#toString() without the hardcoded MAX_FRAMES = 8 restriction on thread stack depth.
 *
 * Returns a string representation of this thread info.
 * The format of this string depends on the implementation.
 * The returned string will typically include
 * the thread name, the getThreadId thread ID, its state,
 * and a stack trace if any.
 *
 * @return a string representation of this thread info.
 */
private static String toString(ThreadInfo info) {
  StringBuilder sb = new StringBuilder("\"" + info.getThreadName() + "\""
      + " Id=" + info.getThreadId() + " " + info.getThreadState());
  if (info.getLockName() != null) {
    sb.append(" on " + info.getLockName());
  }
  if (info.getLockOwnerName() != null) {
    sb.append(" owned by \"" + info.getLockOwnerName() + "\" Id="
        + info.getLockOwnerId());
  }
  if (info.isSuspended()) {
    sb.append(" (suspended)");
  }
  if (info.isInNative()) {
    sb.append(" (in native)");
  }
  sb.append('\n');
  int i = 0;
  for (; i < info.getStackTrace().length; i++) {
    StackTraceElement ste = info.getStackTrace()[i];
    sb.append("\tat " + ste.toString());
    sb.append('\n');
    if (i == 0 && info.getLockInfo() != null) {
      Thread.State ts = info.getThreadState();
      switch (ts) {
        case BLOCKED:
          sb.append("\t-  blocked on " + info.getLockInfo());
          sb.append('\n');
          break;
        case WAITING:
          sb.append("\t-  waiting on " + info.getLockInfo());
          sb.append('\n');
          break;
        case TIMED_WAITING:
          sb.append("\t-  waiting on " + info.getLockInfo());
          sb.append('\n');
          break;
        default:
      }
    }

    for (MonitorInfo mi : info.getLockedMonitors()) {
      if (mi.getLockedStackDepth() == i) {
        sb.append("\t-  locked " + mi);
        sb.append('\n');
      }
    }
  }
  if (i < info.getStackTrace().length) {
    sb.append("\t...");
    sb.append('\n');
  }

  LockInfo[] locks = info.getLockedSynchronizers();
  if (locks.length > 0) {
    sb.append("\n\tNumber of locked synchronizers = " + locks.length);
    sb.append('\n');
    for (LockInfo li : locks) {
      sb.append("\t- " + li);
      sb.append('\n');
    }
  }
  sb.append('\n');
  return sb.toString();
}
 
Example 17
Source File: GfxdLocalLockService.java    From gemfirexd-oss with Apache License 2.0 4 votes vote down vote up
public static void generateThreadDump(StringBuilder msg) {
  ThreadMXBean mbean = ManagementFactory.getThreadMXBean();
  for (ThreadInfo tInfo : mbean.dumpAllThreads(true, true)) {
    msg.append('"').append(tInfo.getThreadName()).append('"').append(" Id=")
        .append(tInfo.getThreadId()).append(' ')
        .append(tInfo.getThreadState());
    if (tInfo.getLockName() != null) {
      msg.append(" on ").append(tInfo.getLockName());
    }
    if (tInfo.getLockOwnerName() != null) {
      msg.append(" owned by \"").append(tInfo.getLockOwnerName())
          .append("\" Id=").append(tInfo.getLockOwnerId());
    }
    if (tInfo.isSuspended()) {
      msg.append(" (suspended)");
    }
    if (tInfo.isInNative()) {
      msg.append(" (in native)");
    }
    msg.append(SanityManager.lineSeparator);
    final StackTraceElement[] stackTrace = tInfo.getStackTrace();
    for (int index = 0; index < stackTrace.length; ++index) {
      msg.append("\tat ").append(stackTrace[index].toString())
          .append(SanityManager.lineSeparator);
      if (index == 0 && tInfo.getLockInfo() != null) {
        final Thread.State ts = tInfo.getThreadState();
        switch (ts) {
          case BLOCKED:
            msg.append("\t-  blocked on ").append(tInfo.getLockInfo())
                .append(SanityManager.lineSeparator);
            break;
          case WAITING:
            msg.append("\t-  waiting on ").append(tInfo.getLockInfo())
                .append(SanityManager.lineSeparator);
            break;
          case TIMED_WAITING:
            msg.append("\t-  waiting on ").append(tInfo.getLockInfo())
                .append(SanityManager.lineSeparator);
            break;
          default:
        }
      }

      for (MonitorInfo mi : tInfo.getLockedMonitors()) {
        if (mi.getLockedStackDepth() == index) {
          msg.append("\t-  locked ").append(mi)
              .append(SanityManager.lineSeparator);
        }
      }
    }

    final LockInfo[] locks = tInfo.getLockedSynchronizers();
    if (locks.length > 0) {
      msg.append(SanityManager.lineSeparator)
          .append("\tNumber of locked synchronizers = ").append(locks.length)
          .append(SanityManager.lineSeparator);
      for (LockInfo li : locks) {
        msg.append("\t- ").append(li).append(SanityManager.lineSeparator);
      }
    }
    msg.append(SanityManager.lineSeparator);
  }
}
 
Example 18
Source File: ExtendedThreadInformation.java    From logging-log4j2 with Apache License 2.0 4 votes vote down vote up
@Override
public void printStack(final StringBuilder sb, final StackTraceElement[] stack) {
    int i = 0;
    for (final StackTraceElement element : stack) {
        sb.append("\tat ").append(element.toString());
        sb.append('\n');
        if (i == 0 && threadInfo.getLockInfo() != null) {
            final Thread.State ts = threadInfo.getThreadState();
            switch (ts) {
                case BLOCKED:
                    sb.append("\t-  blocked on ");
                    formatLock(sb, threadInfo.getLockInfo());
                    sb.append('\n');
                    break;
                case WAITING:
                    sb.append("\t-  waiting on ");
                    formatLock(sb, threadInfo.getLockInfo());
                    sb.append('\n');
                    break;
                case TIMED_WAITING:
                    sb.append("\t-  waiting on ");
                    formatLock(sb, threadInfo.getLockInfo());
                    sb.append('\n');
                    break;
                default:
            }
        }

        for (final MonitorInfo mi : threadInfo.getLockedMonitors()) {
            if (mi.getLockedStackDepth() == i) {
                sb.append("\t-  locked ");
                formatLock(sb, mi);
                sb.append('\n');
            }
        }
        ++i;
    }

    final LockInfo[] locks = threadInfo.getLockedSynchronizers();
    if (locks.length > 0) {
        sb.append("\n\tNumber of locked synchronizers = ").append(locks.length).append('\n');
        for (final LockInfo li : locks) {
            sb.append("\t- ");
            formatLock(sb, li);
            sb.append('\n');
        }
    }
}
 
Example 19
Source File: OWLHandler.java    From owltools with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
private static CharSequence toString(ThreadInfo threadInfo) {
	StringBuilder sb = new StringBuilder("\"" + threadInfo.getThreadName() + "\"" + " Id=" + threadInfo.getThreadId() + " " + threadInfo.getThreadState());
	if (threadInfo.getLockName() != null) {
		sb.append(" on " + threadInfo.getLockName());
	}
	if (threadInfo.getLockOwnerName() != null) {
		sb.append(" owned by \"" + threadInfo.getLockOwnerName() + "\" Id=" + threadInfo.getLockOwnerId());
	}
	if (threadInfo.isSuspended()) {
		sb.append(" (suspended)");
	}
	if (threadInfo.isInNative()) {
		sb.append(" (in native)");
	}
	sb.append('\n');
	StackTraceElement[] stackTrace = threadInfo.getStackTrace();
	int i = 0;
	for (; i < stackTrace.length; i++) {
		StackTraceElement ste = stackTrace[i];
		sb.append("\tat " + ste.toString());
		sb.append('\n');
		if (i == 0 && threadInfo.getLockInfo() != null) {
			Thread.State ts = threadInfo.getThreadState();
			switch (ts) {
			case BLOCKED:
				sb.append("\t-  blocked on " + threadInfo.getLockInfo());
				sb.append('\n');
				break;
			case WAITING:
				sb.append("\t-  waiting on " + threadInfo.getLockInfo());
				sb.append('\n');
				break;
			case TIMED_WAITING:
				sb.append("\t-  waiting on " + threadInfo.getLockInfo());
				sb.append('\n');
				break;
			default:
			}
		}

		for (MonitorInfo mi : threadInfo.getLockedMonitors()) {
			if (mi.getLockedStackDepth() == i) {
				sb.append("\t-  locked " + mi);
				sb.append('\n');
			}
		}
	}
	LockInfo[] locks = threadInfo.getLockedSynchronizers();
	if (locks.length > 0) {
		sb.append("\n\tNumber of locked synchronizers = " + locks.length);
		sb.append('\n');
		for (LockInfo li : locks) {
			sb.append("\t- " + li);
			sb.append('\n');
		}
	}
	sb.append('\n');
	return sb;
}
 
Example 20
Source File: JVMUtil.java    From dubbo-2.6.5 with Apache License 2.0 4 votes vote down vote up
private static String getThreadDumpString(ThreadInfo threadInfo) {
    StringBuilder sb = new StringBuilder("\"" + threadInfo.getThreadName() + "\"" +
            " Id=" + threadInfo.getThreadId() + " " +
            threadInfo.getThreadState());
    if (threadInfo.getLockName() != null) {
        sb.append(" on " + threadInfo.getLockName());
    }
    if (threadInfo.getLockOwnerName() != null) {
        sb.append(" owned by \"" + threadInfo.getLockOwnerName() +
                "\" Id=" + threadInfo.getLockOwnerId());
    }
    if (threadInfo.isSuspended()) {
        sb.append(" (suspended)");
    }
    if (threadInfo.isInNative()) {
        sb.append(" (in native)");
    }
    sb.append('\n');
    int i = 0;

    StackTraceElement[] stackTrace = threadInfo.getStackTrace();
    MonitorInfo[] lockedMonitors = threadInfo.getLockedMonitors();
    for (; i < stackTrace.length && i < 32; i++) {
        StackTraceElement ste = stackTrace[i];
        sb.append("\tat " + ste.toString());
        sb.append('\n');
        if (i == 0 && threadInfo.getLockInfo() != null) {
            Thread.State ts = threadInfo.getThreadState();
            switch (ts) {
                case BLOCKED:
                    sb.append("\t-  blocked on " + threadInfo.getLockInfo());
                    sb.append('\n');
                    break;
                case WAITING:
                    sb.append("\t-  waiting on " + threadInfo.getLockInfo());
                    sb.append('\n');
                    break;
                case TIMED_WAITING:
                    sb.append("\t-  waiting on " + threadInfo.getLockInfo());
                    sb.append('\n');
                    break;
                default:
            }
        }

        for (MonitorInfo mi : lockedMonitors) {
            if (mi.getLockedStackDepth() == i) {
                sb.append("\t-  locked " + mi);
                sb.append('\n');
            }
        }
    }
    if (i < stackTrace.length) {
        sb.append("\t...");
        sb.append('\n');
    }

    LockInfo[] locks = threadInfo.getLockedSynchronizers();
    if (locks.length > 0) {
        sb.append("\n\tNumber of locked synchronizers = " + locks.length);
        sb.append('\n');
        for (LockInfo li : locks) {
            sb.append("\t- " + li);
            sb.append('\n');
        }
    }
    sb.append('\n');
    return sb.toString();
}