com.codahale.metrics.jvm.ThreadDump Java Examples

The following examples show how to use com.codahale.metrics.jvm.ThreadDump. 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: ProcessExit.java    From dcos-commons with Apache License 2.0 5 votes vote down vote up
/**
 * Immediately exits the process with the ordinal value of the provided {@link ProcessExit}.
 */
@SuppressWarnings("DM_EXIT")
public static void exit(Code code) {
  String message = String.format(
      "Process exiting immediately with code: %s[%d]",
      code,
      code.getValue());
  System.err.println(message);
  System.out.println(message); // SUPPRESS CHECKSTYLE RegexpSinglelineJava
  System.err.println("Printing final thread state...");
  new ThreadDump(ManagementFactory.getThreadMXBean()).dump(System.err);
  System.exit(code.getValue());
}
 
Example #2
Source File: ThreadDumpHandler.java    From pippo with Apache License 2.0 5 votes vote down vote up
public ThreadDumpHandler() {
    try {
        // some PaaS like Google App Engine blacklist "java.lang.management" package
        threadDump = new ThreadDump(ManagementFactory.getThreadMXBean());
    } catch (NoClassDefFoundError e) {
        log.warn("Thread dump isn't available", e);
    }
}
 
Example #3
Source File: ThreadsHandler.java    From styx with Apache License 2.0 4 votes vote down vote up
/**
 * Constructs an instance.
 */
public ThreadsHandler() {
    this.threadDump = new ThreadDump(getThreadMXBean());
}