public class ThreadMonitor extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
THREAD_MONITOR_DEACTIVATED |
| Modifier and Type | Method and Description |
|---|---|
File |
dumpThreadInfo(boolean toSysOut,
boolean toFile)
Prints the thread dump information to System.out or/and to a file.
|
File |
dumpThreadInfoWithInterval(boolean toSysOut,
boolean toFile,
int threadDumpCount,
int intervalSeconds)
Starts a background thread to do series of thread dumps with the specified interval.
|
String |
findDeadlock()
Checks if any threads are deadlocked.
|
void |
generateThreadInfo(Writer writer)
Generates a string with the full thread dump information.
|
long |
getDumpsGenerated() |
static ThreadMonitor |
getInstance()
Retrieves the singleton instance, creating it if it doesn't exist yet.
|
long |
getLastDumpTime() |
long |
getMinimalIntervalBetweenDumps() |
boolean |
isActivated() |
boolean |
isDebugLogging() |
boolean |
isDumping() |
void |
setActivated(boolean activated)
With this method you can activate/deactivate thread dumping methods.
|
void |
setDebugLogging(boolean debugLogging)
Activate this to output concurrent call logging to System.out
|
void |
setMinimalIntervalBetweenDumps(long minimalIntervalBetweenDumps)
Sets the minimal interval allowed between thread dumps.
|
static void |
shutdownInstance()
Shuts down the singleton instance, calls this when undeploying your application, or call it from the
dependency injection system upon destruction of the application context.
|
public static final String THREAD_MONITOR_DEACTIVATED
public static ThreadMonitor getInstance()
public static void shutdownInstance()
public boolean isDebugLogging()
public void setDebugLogging(boolean debugLogging)
debugLogging - public boolean isActivated()
public void setActivated(boolean activated)
activated - public long getMinimalIntervalBetweenDumps()
public void setMinimalIntervalBetweenDumps(long minimalIntervalBetweenDumps)
minimalIntervalBetweenDumps - specified in milliseconds (default value is 20ms).public boolean isDumping()
public File dumpThreadInfo(boolean toSysOut, boolean toFile)
toSysOut - print the generated thread dump to a System.outtoFile - print the generated thread dump to a filepublic File dumpThreadInfoWithInterval(boolean toSysOut, boolean toFile, int threadDumpCount, int intervalSeconds)
toSysOut - print the generated thread dump to a System.outtoFile - print the generated thread dump to a filethreadDumpCount - the number of thread dumps to dointervalSeconds - the interval between thread dumps in secondspublic String findDeadlock()
public void generateThreadInfo(Writer writer)
writer - the output writerpublic long getDumpsGenerated()
public long getLastDumpTime()
Copyright © 2004–2020 Jahia Solutions Group SA. All rights reserved.