Package org.apache.tomcat.util
Class Diagnostics
java.lang.Object
org.apache.tomcat.util.Diagnostics
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic StringCheck if any threads are deadlocked.static voidgc()Initiate garbage collection via MX Beanstatic StringRetrieves a formatted JVM thread dump.static StringgetThreadDump(Enumeration<Locale> requestedLocales) Retrieves a formatted JVM thread dump.static StringgetThreadDump(StringManager requestedSm) Retrieve a JVM thread dump formatted using the given StringManager.static StringRetrieves a formatted JVM information text.static StringgetVMInfo(Enumeration<Locale> requestedLocales) Retrieves a formatted JVM information text.static StringgetVMInfo(StringManager requestedSm) Retrieve a JVM information text formatted using the given StringManager.static booleanCheck whether thread contention monitoring is enabled.static booleanCheck whether thread cpu time measurement is enabled.static voidReset peak thread count in ThreadMXBeanstatic voidresetPeakUsage(String name) Reset peak memory usage data in MemoryPoolMXBeanstatic booleansetCollectionUsageThreshold(String name, long threshold) Set collection usage threshold in MemoryPoolMXBeanstatic voidsetLoggerLevel(String loggerName, String levelName) Set logger levelstatic voidsetThreadContentionMonitoringEnabled(boolean enable) Enable or disable thread contention monitoring via the ThreadMxMXBean.static voidsetThreadCpuTimeEnabled(boolean enable) Enable or disable thread cpu time measurement via the ThreadMxMXBean.static booleansetUsageThreshold(String name, long threshold) Set usage threshold in MemoryPoolMXBeanstatic voidsetVerboseClassLoading(boolean verbose) Set verbose class loadingstatic voidsetVerboseGarbageCollection(boolean verbose) Set verbose garbage collection logging
- 
Constructor Details- 
Diagnosticspublic Diagnostics()
 
- 
- 
Method Details- 
isThreadContentionMonitoringEnabledpublic static boolean isThreadContentionMonitoringEnabled()Check whether thread contention monitoring is enabled.- Returns:
- true if thread contention monitoring is enabled
 
- 
setThreadContentionMonitoringEnabledpublic static void setThreadContentionMonitoringEnabled(boolean enable) Enable or disable thread contention monitoring via the ThreadMxMXBean.- Parameters:
- enable- whether to enable thread contention monitoring
 
- 
isThreadCpuTimeEnabledpublic static boolean isThreadCpuTimeEnabled()Check whether thread cpu time measurement is enabled.- Returns:
- true if thread cpu time measurement is enabled
 
- 
setThreadCpuTimeEnabledpublic static void setThreadCpuTimeEnabled(boolean enable) Enable or disable thread cpu time measurement via the ThreadMxMXBean.- Parameters:
- enable- whether to enable thread cpu time measurement
 
- 
resetPeakThreadCountpublic static void resetPeakThreadCount()Reset peak thread count in ThreadMXBean
- 
setVerboseClassLoadingpublic static void setVerboseClassLoading(boolean verbose) Set verbose class loading- Parameters:
- verbose- whether to enable verbose class loading
 
- 
setLoggerLevelSet logger level- Parameters:
- loggerName- the name of the logger
- levelName- the level to set
 
- 
setVerboseGarbageCollectionpublic static void setVerboseGarbageCollection(boolean verbose) Set verbose garbage collection logging- Parameters:
- verbose- whether to enable verbose gc logging
 
- 
gcpublic static void gc()Initiate garbage collection via MX Bean
- 
resetPeakUsageReset peak memory usage data in MemoryPoolMXBean- Parameters:
- name- name of the MemoryPoolMXBean or "all"
 
- 
setUsageThresholdSet usage threshold in MemoryPoolMXBean- Parameters:
- name- name of the MemoryPoolMXBean
- threshold- the threshold to set
- Returns:
- true if setting the threshold succeeded
 
- 
setCollectionUsageThresholdSet collection usage threshold in MemoryPoolMXBean- Parameters:
- name- name of the MemoryPoolMXBean
- threshold- the collection threshold to set
- Returns:
- true if setting the threshold succeeded
 
- 
findDeadlockCheck if any threads are deadlocked. If any, print the thread dump for those threads.- Returns:
- a deadlock message and the formatted thread dump of the deadlocked threads
 
- 
getThreadDumpRetrieves a formatted JVM thread dump. The default StringManager will be used.- Returns:
- the formatted JVM thread dump
 
- 
getThreadDumpRetrieves a formatted JVM thread dump. The given list of locales will be used to retrieve a StringManager.- Parameters:
- requestedLocales- list of locales to use
- Returns:
- the formatted JVM thread dump
 
- 
getThreadDumpRetrieve a JVM thread dump formatted using the given StringManager.- Parameters:
- requestedSm- the StringManager to use
- Returns:
- the formatted JVM thread dump
 
- 
getVMInfoRetrieves a formatted JVM information text. The default StringManager will be used.- Returns:
- the formatted JVM information text
 
- 
getVMInfoRetrieves a formatted JVM information text. The given list of locales will be used to retrieve a StringManager.- Parameters:
- requestedLocales- list of locales to use
- Returns:
- the formatted JVM information text
 
- 
getVMInfoRetrieve a JVM information text formatted using the given StringManager.- Parameters:
- requestedSm- the StringManager to use
- Returns:
- the formatted JVM information text
 
 
-