@ManagedObject(value="Busy Thread Monitor") public class ThreadMonitor extends AbstractLifeCycle implements Runnable
AbstractLifeCycle.AbstractLifeCycleListenerLifeCycle.Listener| Constructor and Description |
|---|
ThreadMonitor()
Instantiates a new thread monitor.
|
ThreadMonitor(int intervalMs)
Instantiates a new thread monitor.
|
ThreadMonitor(int intervalMs,
int threshold)
Instantiates a new thread monitor.
|
ThreadMonitor(int intervalMs,
int threshold,
int depth)
Instantiates a new thread monitor.
|
ThreadMonitor(int intervalMs,
int threshold,
int depth,
int trail)
Instantiates a new thread monitor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
doStart() |
void |
doStop() |
protected long[] |
getAllThreadIds()
Retrieve all avaliable thread ids
|
int |
getBusyThreshold()
Gets the busy threshold.
|
Dumpable |
getDumpable() |
int |
getLogInterval()
Gets the log interval.
|
int |
getLogThreshold()
Gets the log threshold.
|
int |
getScanInterval()
Gets the scan interval.
|
int |
getStackDepth()
Gets the stack depth.
|
protected long |
getThreadCpuTime(long id)
Retrieve the cpu time for specified thread.
|
int |
getTrailLength()
Gets the stack trace trail length.
|
protected void |
init()
Initialize JMX objects.
|
void |
logCpuUsage(int frequencyMs,
int thresholdPercent)
Enable logging of CPU usage.
|
protected void |
logThreadInfo(boolean logAll) |
void |
run() |
void |
setBusyThreshold(int percent)
Sets the busy threshold.
|
void |
setDumpable(Dumpable dumpable) |
void |
setLogInterval(int ms)
Sets the log interval.
|
void |
setLogThreshold(int percent)
Sets the log threshold.
|
void |
setScanInterval(int ms)
Sets the scan interval.
|
void |
setStackDepth(int stackDepth)
Sets the stack depth.
|
void |
setTrailLength(int trailLength)
Sets the stack trace trail length.
|
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, setStopTimeout, start, stoppublic ThreadMonitor()
throws Exception
Exceptionpublic ThreadMonitor(int intervalMs)
throws Exception
intervalMs - scan intervalExceptionpublic ThreadMonitor(int intervalMs,
int threshold)
throws Exception
intervalMs - scan intervalthreshold - busy thresholdExceptionpublic ThreadMonitor(int intervalMs,
int threshold,
int depth)
throws Exception
intervalMs - scan intervalthreshold - busy thresholddepth - stack compare depthExceptionpublic int getScanInterval()
public void setScanInterval(int ms)
ms - the new scan intervalpublic int getLogInterval()
public void setLogInterval(int ms)
ms - the new log intervalpublic int getBusyThreshold()
public void setBusyThreshold(int percent)
percent - the new busy thresholdpublic int getLogThreshold()
public void setLogThreshold(int percent)
percent - the new log thresholdpublic int getStackDepth()
public void setStackDepth(int stackDepth)
stackDepth - the new stack depthpublic void setTrailLength(int trailLength)
trailLength - the new trail lengthpublic int getTrailLength()
public void logCpuUsage(int frequencyMs,
int thresholdPercent)
frequencyMs - the logging frequencythresholdPercent - the logging thresholdpublic Dumpable getDumpable()
Dumpable that is dumped whenever spinning threads are detectedpublic void setDumpable(Dumpable dumpable)
dumpable - A Dumpable that is dumped whenever spinning threads are detectedpublic void doStart()
doStart in class AbstractLifeCycleAbstractLifeCycle.doStart()public void doStop()
doStop in class AbstractLifeCycleAbstractLifeCycle.doStop()protected long[] getAllThreadIds()
protected long getThreadCpuTime(long id)
id - thread idprotected void init()
public void run()
run in interface RunnableRunnable.run()protected void logThreadInfo(boolean logAll)
Copyright © 1995-2015 Webtide. All Rights Reserved.