ThreadHistoryMonitorHelperMXBean
public class ThreadHistoryMonitorHelper extends Helper implements ThreadHistoryMonitorHelperMXBean
Helper class used by ThreadHistoryMonitorHelper script to trace thread operations. This is essentially an extension of the ThreadMonitorHelper which uses maps to store the thread history rather than writing it out.
The helper also implements ThreadHistoryMonitorHelperMXBean to allow this class to be registered as an mbean @see #registerHelperMBean(String).
Modifier | Constructor | Description |
---|---|---|
protected |
ThreadHistoryMonitorHelper(Rule rule) |
Modifier and Type | Method | Description |
---|---|---|
static void |
activated() |
Looks to the org.jboss.byteman.sample.helper.debug system property to
set the class DEBUG mode flag.
|
ThreadMonitorEvent[] |
getCreateEvents() |
Get the array of thread creation events.
|
String |
getEventReport() |
Get a string description of all thread events.
|
ThreadMonitorEvent[] |
getExitEvents() |
Get the array of thread exit events.
|
ThreadMonitorEvent[] |
getRunEvents() |
Get the array of Runnable.run events.
|
ThreadMonitorEvent[] |
getStartEvents() |
Get the array of thread start events.
|
static void |
installed(Rule rule) |
|
ThreadMonitorEvent |
newThreadEvent(ThreadMonitored threadMonitored,
Thread thread,
ThreadMonitorEventType eventType) |
Common ThreadMonitorEvent creation method.
|
void |
registerHelperMBean(String name) |
Register the INSTANCE as an mbean under the given name.
|
void |
traceCreate(Thread thread,
int depth) |
trace creation of the supplied thread to System.out
this should only be triggered from the
Thread constructor |
void |
traceExit(Thread thread) |
trace exit of the supplied thread to System.out
this should only be triggered from the call to
Thread exit method |
void |
traceInterrupt(Thread thread) |
trace interrupted of the supplied thread to System.out
this should only be triggered from the call to
Thread.interrupt() |
void |
traceRun(Runnable runnable) |
trace run of the supplied Runnable to System.out
this should only be triggered from a call to an implementation of
Runnable.run() |
void |
traceStart(Thread thread) |
trace start of the supplied thread to System.out
this should only be triggered from the call to java.lang.Thread.start"
|
void |
writeAllEventsToFile(String path) |
Write all events to the file given by path
|
void |
writeAllEventsToFile(String path,
int sampleCount) |
Write all events to the file given by path, repeating sampleCount times
at 5 second intervals.
|
void |
writeEventsToFile(String type,
String path) |
Write a report of all events of the indicated type to the given path.
|
addCountDown, callerCheck, callerEquals, callerEquals, callerEquals, callerEquals, callerEquals, callerEquals, callerEquals, callerEquals, callerEquals, callerMatches, callerMatches, callerMatches, callerMatches, callerMatches, callerMatches, callerMatches, callerMatches, callerMatches, clear, clearLinks, clearLinks, closeTrace, countDown, createCountDown, createCounter, createCounter, createJoin, createLinkMap, createRendezvous, createRendezvous, createTimer, deactivated, debug, decrementCounter, delay, deleteCounter, deleteLinkMap, deleteRendezvous, deleteTimer, err, errTraceException, flag, flagged, formatAllStacks, formatAllStacks, formatAllStacks, formatAllStacks, formatStack, formatStack, formatStack, formatStack, formatStackBetween, formatStackBetween, formatStackBetween, formatStackBetween, formatStackBetween, formatStackBetween, formatStackBetweenMatches, formatStackBetweenMatches, formatStackBetweenMatches, formatStackBetweenMatches, formatStackBetweenMatches, formatStackBetweenMatches, formatStackMatching, formatStackMatching, formatStackMatching, formatStackMatching, formatStackMatching, formatStackMatching, formatStackRange, formatThreadStack, formatThreadStack, formatThreadStack, formatThreadStack, getCountDown, getElapsedTimeFromTimer, getObjectSize, getRendezvous, getStack, incrementCounter, incrementCounter, isCountDown, isJoin, isRendezvous, joinEnlist, joinWait, joinWait, killJVM, killJVM, killThread, link, link, linked, linked, linkNames, linkNames, linkValues, linkValues, matchIndex, noisy, noisyTraceException, openTrace, openTrace, out, outTraceException, printFrame, printlnFrame, readCounter, readCounter, rendezvous, rendezvous, resetTimer, setTriggering, signalKill, signalKill, signalThrow, signalThrow, signalWake, signalWake, toString, trace, trace, traceAllStacks, traceAllStacks, traceAllStacks, traceAllStacks, traceAllStacks, traceAllStacks, traceClose, traceln, traceln, traceOpen, traceOpen, traceStack, traceStack, traceStack, traceStack, traceStack, traceStack, traceStackBetween, traceStackBetween, traceStackBetween, traceStackBetween, traceStackBetween, traceStackBetween, traceStackBetween, traceStackBetween, traceStackBetween, traceStackBetweenMatches, traceStackBetweenMatches, traceStackBetweenMatches, traceStackBetweenMatches, traceStackBetweenMatches, traceStackBetweenMatches, traceStackBetweenMatches, traceStackBetweenMatches, traceStackBetweenMatches, traceStackMatching, traceStackMatching, traceStackMatching, traceStackMatching, traceStackMatching, traceStackMatching, traceStackMatching, traceStackMatching, traceStackMatching, traceStackRange, traceThreadStack, traceThreadStack, traceThreadStack, traceThreadStack, traceThreadStack, traceThreadStack, triggerIndex, uninstalled, unlink, unlink, verbose, verboseTraceException, waitFor, waitFor, waiting
protected ThreadHistoryMonitorHelper(Rule rule)
public static void activated()
public static void installed(Rule rule)
public void registerHelperMBean(String name)
name
- - the object name string to register the INSTANCE underpublic void traceCreate(Thread thread, int depth)
Thread
constructorthread
- the newly created threaddepth
- unusedpublic void traceStart(Thread thread)
thread
- the newly starting threadpublic void traceExit(Thread thread)
Thread
exit methodthread
- the exiting threadpublic void traceInterrupt(Thread thread)
Thread.interrupt()
thread
- the interrupting threadpublic void traceRun(Runnable runnable)
Runnable.run()
runnable
- the runnable being runpublic ThreadMonitorEvent[] getCreateEvents()
ThreadHistoryMonitorHelperMXBean
getCreateEvents
in interface ThreadHistoryMonitorHelperMXBean
public ThreadMonitorEvent[] getStartEvents()
ThreadHistoryMonitorHelperMXBean
getStartEvents
in interface ThreadHistoryMonitorHelperMXBean
public ThreadMonitorEvent[] getExitEvents()
ThreadHistoryMonitorHelperMXBean
getExitEvents
in interface ThreadHistoryMonitorHelperMXBean
public ThreadMonitorEvent[] getRunEvents()
ThreadHistoryMonitorHelperMXBean
getRunEvents
in interface ThreadHistoryMonitorHelperMXBean
public String getEventReport() throws IOException
ThreadHistoryMonitorHelperMXBean
ThreadHistoryMonitorHelperMXBean.writeAllEventsToFile(String)
.getEventReport
in interface ThreadHistoryMonitorHelperMXBean
IOException
- if an io error occurspublic void writeEventsToFile(String type, String path) throws IOException
ThreadHistoryMonitorHelperMXBean
writeEventsToFile
in interface ThreadHistoryMonitorHelperMXBean
type
- - one of create, start, exit, run; case insensitivepath
- - the pathname of the file to write the event report to.IOException
- if an io error occurspublic void writeAllEventsToFile(String path) throws IOException
writeAllEventsToFile
in interface ThreadHistoryMonitorHelperMXBean
path
- path to fileIOException
- if an io error occurspublic void writeAllEventsToFile(String path, int sampleCount) throws IOException
path
- - the path to the event report filesampleCount
- - the number of samples to takeIOException
- - thrown on any IO failurepublic ThreadMonitorEvent newThreadEvent(ThreadMonitored threadMonitored, Thread thread, ThreadMonitorEventType eventType)
thread
- - the thread associated with the eventeventType
- - the type of the event.Copyright © 2018. All rights reserved.