/** * Retrieves a formatted JVM thread dump. * The default StringManager will be used. * * @return the formatted JVM thread dump */ public static String getThreadDump() { return getThreadDump(sm); }
/** * Retrieves a formatted JVM thread dump. * The default StringManager will be used. * * @return the formatted JVM thread dump */ public static String getThreadDump() { return getThreadDump(sm); }
/** * * Write a JVM thread dump * * @param writer */ protected void threadDump(PrintWriter writer, Enumeration<Locale> requestedLocales) { writer.print(Diagnostics.getThreadDump(requestedLocales)); }
/** * Formats the thread dump for a list of threads. * * @param tinfos the ThreadInfo array describing the thread list * @return the formatted thread dump */ private static String getThreadDump(ThreadInfo[] tinfos) { StringBuilder sb = new StringBuilder(); for (ThreadInfo tinfo : tinfos) { sb.append(getThreadDump(tinfo)); sb.append(CRLF); } return sb.toString(); }
/** * Formats the thread dump for a list of threads. * * @param tinfos the ThreadInfo array describing the thread list * @return the formatted thread dump */ private static String getThreadDump(ThreadInfo[] tinfos) { StringBuilder sb = new StringBuilder(); for (ThreadInfo tinfo : tinfos) { sb.append(getThreadDump(tinfo)); sb.append(CRLF); } return sb.toString(); }
/** * Write a JVM thread dump. * * @param writer The output writer * @param smClient StringManager for the client's locale * @param requestedLocales the client's locales */ protected void threadDump(PrintWriter writer, StringManager smClient, Enumeration<Locale> requestedLocales) { writer.println(smClient.getString("managerServlet.threaddump")); writer.print(Diagnostics.getThreadDump(requestedLocales)); }
/** * Retrieves a formatted JVM thread dump. * The given list of locales will be used * to retrieve a StringManager. * * @param requestedLocales list of locales to use * @return the formatted JVM thread dump */ public static String getThreadDump(Enumeration<Locale> requestedLocales) { return getThreadDump( StringManager.getManager(PACKAGE, requestedLocales)); }
/** * Write a JVM thread dump. * * @param writer The output writer * @param smClient StringManager for the client's locale * @param requestedLocales the client's locales */ protected void threadDump(PrintWriter writer, StringManager smClient, Enumeration<Locale> requestedLocales) { writer.println(smClient.getString("managerServlet.threaddump")); writer.print(Diagnostics.getThreadDump(requestedLocales)); }
/** * Retrieves a formatted JVM thread dump. * The given list of locales will be used * to retrieve a StringManager. * * @param requestedLocales list of locales to use * @return the formatted JVM thread dump */ public static String getThreadDump(Enumeration<Locale> requestedLocales) { return getThreadDump( StringManager.getManager(PACKAGE, requestedLocales)); }
/** * Check if any threads are deadlocked. If any, print * the thread dump for those threads. * * @return a deadlock message and the formatted thread dump * of the deadlocked threads */ public static String findDeadlock() { ThreadInfo[] tinfos = null; long[] ids = threadMXBean.findDeadlockedThreads(); if (ids != null) { tinfos = threadMXBean.getThreadInfo(threadMXBean.findDeadlockedThreads(), true, true); if (tinfos != null) { StringBuilder sb = new StringBuilder("Deadlock found between the following threads:"); sb.append(CRLF); sb.append(getThreadDump(tinfos)); return sb.toString(); } } return ""; }
/** * Check if any threads are deadlocked. If any, print * the thread dump for those threads. * * @return a deadlock message and the formatted thread dump * of the deadlocked threads */ public static String findDeadlock() { ThreadInfo[] tinfos = null; long[] ids = threadMXBean.findDeadlockedThreads(); if (ids != null) { tinfos = threadMXBean.getThreadInfo(threadMXBean.findDeadlockedThreads(), true, true); if (tinfos != null) { StringBuilder sb = new StringBuilder("Deadlock found between the following threads:"); sb.append(CRLF); sb.append(getThreadDump(tinfos)); return sb.toString(); } } return ""; }
/** * Retrieve a JVM thread dump formatted * using the given StringManager. * * @param requestedSm the StringManager to use * @return the formatted JVM thread dump */ public static String getThreadDump(StringManager requestedSm) { StringBuilder sb = new StringBuilder(); synchronized(timeformat) { sb.append(timeformat.format(new Date())); } sb.append(CRLF); sb.append(requestedSm.getString("diagnostics.threadDumpTitle")); sb.append(" "); sb.append(runtimeMXBean.getVmName()); sb.append(" ("); sb.append(runtimeMXBean.getVmVersion()); String vminfo = System.getProperty(vminfoSystemProperty); if (vminfo != null) { sb.append(" " + vminfo); } sb.append("):" + CRLF); sb.append(CRLF); ThreadInfo[] tis = threadMXBean.dumpAllThreads(true, true); sb.append(getThreadDump(tis)); sb.append(findDeadlock()); return sb.toString(); }
/** * Retrieve a JVM thread dump formatted * using the given StringManager. * * @param requestedSm the StringManager to use * @return the formatted JVM thread dump */ public static String getThreadDump(StringManager requestedSm) { StringBuilder sb = new StringBuilder(); synchronized(timeformat) { sb.append(timeformat.format(new Date())); } sb.append(CRLF); sb.append(requestedSm.getString("diagnostics.threadDumpTitle")); sb.append(" "); sb.append(runtimeMXBean.getVmName()); sb.append(" ("); sb.append(runtimeMXBean.getVmVersion()); String vminfo = System.getProperty(vminfoSystemProperty); if (vminfo != null) { sb.append(" " + vminfo); } sb.append("):" + CRLF); sb.append(CRLF); ThreadInfo[] tis = threadMXBean.dumpAllThreads(true, true); sb.append(getThreadDump(tis)); sb.append(findDeadlock()); return sb.toString(); }