JDK-8274687 will add the following fragment to doPendingTasks() in the JDWP agent:
/*
* trackAppResume() (indirectly) aquires handlerLock. For proper lock
* ordering handlerLock has to be acquired before threadLock.
*/
debugMonitorExit(threadLock);
eventHandler_lock();
debugMonitorEnter(threadLock);
Investigate if this can be improved by hoisting the first monitor exit on threadLock up into the caller threadControl_onEventHandlerExit() such that doPendingTasks() would be called without any locks held.