Package rma.util.debug
Class MonitorEdtQueue
java.lang.Object
java.awt.EventQueue
rma.util.debug.MonitorEdtQueue
Monitors the AWT event dispatch thread for events that take longer than a certain time to be dispatched.
The principle is to record the time at which we start processing an event, and have another thread check frequently to see if
we're still processing. If the other thread notices that we've been processing a single event for too long, it prints a stack
trace showing what the event dispatch thread is doing, and continues to time it until it finally finishes.
This is useful in determining what code is causing your Java application's GUI to be unresponsive.
The original blog can be found here
Automatically detecting AWT event dispatch thread hangs
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddispatchEvent(AWTEvent event) Overrides EventQueue.dispatchEvent to call our pre and post hooks either side of the system's event dispatch code.static voidSets up hang detection for the event dispatch thread.static voidstatic BooleanCalls MonitorEdtQueue.initMonitoring() if MonitorEdtQueue.PROP is true.Methods inherited from class java.awt.EventQueue
createSecondaryLoop, getCurrentEvent, getMostRecentEventTime, getNextEvent, invokeAndWait, invokeLater, isDispatchThread, peekEvent, peekEvent, pop, postEvent, push
-
Field Details
-
PROP
- See Also:
-
-
Method Details
-
initMonitoring
public static void initMonitoring()Sets up hang detection for the event dispatch thread. -
dispatchEvent
Overrides EventQueue.dispatchEvent to call our pre and post hooks either side of the system's event dispatch code.- Overrides:
dispatchEventin classEventQueue
-
possiblyInstall
Calls MonitorEdtQueue.initMonitoring() if MonitorEdtQueue.PROP is true.- Returns:
- true if the install method was called.
-
main
-