Class Stacktraces

java.lang.Object
com.pnfsoftware.jeb.util.base.Stacktraces

public class Stacktraces extends Object
Utility routines to format stack-traces.
  • Constructor Details

    • Stacktraces

      public Stacktraces()
  • Method Details

    • getCallerString

      public static String getCallerString(String... skiplist)
      Retrieve a compact string identifying the first caller after the skipped stack frames.
      Parameters:
      skiplist - class name prefixes to skip before selecting a caller
      Returns:
      caller string, or null if none was found
    • getCallerString

      public static String getCallerString(StackTraceElement[] stlist, String... skiplist)
      Retrieve a compact string identifying the first caller after the skipped stack frames.
      Parameters:
      stlist - optional stack trace elements; if null, the current thread stack is used
      skiplist - classes in the stack frame to be skipped before the first "interesting" caller
      Returns:
      caller string, or null if none was found
    • formatCallerOriginString

      public static String formatCallerOriginString()
      Format the current call origin chain.
      Returns:
      formatted caller origin string
    • formatCallerOriginString

      public static String formatCallerOriginString(StackTraceElement[] stlist)
      Format a call origin chain.
      Parameters:
      stlist - optional stack trace elements; if null, the current thread stack is used
      Returns:
      formatted caller origin string
    • formatCallerOriginString

      public static String formatCallerOriginString(StackTraceElement[] stlist, int start)
      Format a call origin chain starting at a stack trace index.
      Parameters:
      stlist - optional stack trace elements; if null, the current thread stack is used
      start - first stack trace element index to format
      Returns:
      formatted caller origin string
    • formatThreadStacktraces

      public static String formatThreadStacktraces()
      Format the stack traces of all currently alive threads.
      Returns:
      a record of threads and their current stacktraces
    • formatThreadStacktraces

      public static String formatThreadStacktraces(boolean excludeCurrentThread, boolean includeDeadThreads)
      Format the stack traces of all threads.
      Parameters:
      excludeCurrentThread - true to omit the current thread
      includeDeadThreads - true to include non-alive threads returned by the JVM
      Returns:
      a record of threads and their current stacktraces