public static List<String> jStack() throws Exception {
        final List<String> stackList = new LinkedList<>();
        final Map<Thread, StackTraceElement[]> allStackTraces = Thread.getAllStackTraces();
        for (final Map.Entry<Thread, StackTraceElement[]> entry : allStackTraces.entrySet()) {
            final Thread thread = entry.getKey();
            final StackTraceElement[] stackTraces = entry.getValue();

            stackList.add(String.format("\"%s\" tid=%s isDaemon=%s priority=%s" + Constants.NEWLINE, thread.getName(),
                thread.getId(), thread.isDaemon(), thread.getPriority()));

            stackList.add("java.lang.Thread.State: " + thread.getState() + Constants.NEWLINE);

            if (stackTraces != null) {
                for (final StackTraceElement s : stackTraces) {
                    stackList.add("    " + s.toString() + Constants.NEWLINE);
                }
            }
        }
        return stackList;
    }
Returns java stack traces of java threads for the current
java process.
jraft-rheakv/rheakv-core/src/main/java/com/alipay/sofa/jraft/rhea/util/JvmTools.java