我们有一个 Swing 应用程序。问题是Windows 7
无法关闭 - 消息“还有程序在后台运行”出现,关闭 Windows 的唯一方法是按下强制按钮。
我们有shutdownHook处理程序,它会杀死我们需要杀死的所有东西,但是......此外,分析器在本机JVM
方法中显示了2个死锁:
AWT-EventQueue-0 <--- Frozen for at least 12s
sun.awt.windows.WComponentPeer.nativeHandleEvent(AWTEvent)
sun.awt.windows.WComponentPeer.handleEvent(AWTEvent)
sun.awt.windows.WWindowPeer.handleEvent(AWTEvent)
java.awt.Component.dispatchEventImpl(AWTEvent)
java.awt.Container.dispatchEventImpl(AWTEvent)
java.awt.Window.dispatchEventImpl(AWTEvent)
java.awt.Component.dispatchEvent(AWTEvent)
java.awt.KeyboardFocusManager.redispatchEvent(Component, AWTEvent)
java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Component, AWTEvent)
java.awt.DefaultKeyboardFocusManager.dispatchEvent(AWTEvent)
java.awt.Component.dispatchEventImpl(AWTEvent)
java.awt.Container.dispatchEventImpl(AWTEvent)
java.awt.Window.dispatchEventImpl(AWTEvent)
java.awt.Component.dispatchEvent(AWTEvent)
java.awt.EventQueue.dispatchEventImpl(AWTEvent, Object)
java.awt.EventQueue.access$400(EventQueue, AWTEvent, Object)
java.awt.EventQueue$2.run()<2 recursive calls>
java.security.AccessController.doPrivileged(PrivilegedAction, AccessControlContext)
java.security.AccessControlContext$1.doIntersectionPrivilege(PrivilegedAction, AccessControlContext, AccessControlContext)
java.security.AccessControlContext$1.doIntersectionPrivilege(PrivilegedAction, AccessControlContext)
java.awt.EventQueue$3.run()<2 recursive calls>
java.security.AccessController.doPrivileged(PrivilegedAction, AccessControlContext)
java.security.AccessControlContext$1.doIntersectionPrivilege(PrivilegedAction, AccessControlContext, AccessControlContext)
java.awt.EventQueue.dispatchEvent(AWTEvent)
java.awt.SentEvent.dispatch()
java.awt.DefaultKeyboardFocusManager$DefaultKeyboardFocusManagerSentEvent.dispatch()
java.awt.DefaultKeyboardFocusManager.sendMessage(Component, AWTEvent)
java.awt.DefaultKeyboardFocusManager.dispatchEvent(AWTEvent)
java.awt.Component.dispatchEventImpl(AWTEvent)
java.awt.Container.dispatchEventImpl(AWTEvent)
java.awt.Window.dispatchEventImpl(AWTEvent)
java.awt.Component.dispatchEvent(AWTEvent)
java.awt.EventQueue.dispatchEventImpl(AWTEvent, Object)
java.awt.EventQueue.access$400(EventQueue, AWTEvent, Object)
java.awt.EventQueue$2.run()<2 recursive calls>
java.security.AccessController.doPrivileged(PrivilegedAction, AccessControlContext)
java.security.AccessControlContext$1.doIntersectionPrivilege(PrivilegedAction, AccessControlContext, AccessControlContext)
java.security.AccessControlContext$1.doIntersectionPrivilege(PrivilegedAction, AccessControlContext)
java.awt.EventQueue$3.run()<2 recursive calls>
java.security.AccessController.doPrivileged(PrivilegedAction, AccessControlContext)
java.security.AccessControlContext$1.doIntersectionPrivilege(PrivilegedAction, AccessControlContext, AccessControlContext)
java.awt.EventQueue.dispatchEvent(AWTEvent)
java.awt.SequencedEvent.dispatch()
java.awt.EventQueue.dispatchEventImpl(AWTEvent, Object)
java.awt.EventQueue.access$400(EventQueue, AWTEvent, Object)
java.awt.EventQueue$2.run()<2 recursive calls>
java.security.AccessController.doPrivileged(PrivilegedAction, AccessControlContext)
java.security.AccessControlContext$1.doIntersectionPrivilege(PrivilegedAction, AccessControlContext, AccessControlContext)
java.security.AccessControlContext$1.doIntersectionPrivilege(PrivilegedAction, AccessControlContext)
java.awt.EventQueue$3.run()<2 recursive calls>
java.security.AccessController.doPrivileged(PrivilegedAction, AccessControlContext)
java.security.AccessControlContext$1.doIntersectionPrivilege(PrivilegedAction, AccessControlContext, AccessControlContext)
java.awt.EventQueue.dispatchEvent(AWTEvent)
java.awt.EventDispatchThread.pumpOneEventForFilters(int)
java.awt.EventDispatchThread.pumpEventsForFilter(int, Conditional, EventFilter)
java.awt.EventDispatchThread.pumpEventsForHierarchy(int, Conditional, Component)
java.awt.EventDispatchThread.pumpEvents(int, Conditional)
java.awt.EventDispatchThread.pumpEvents(Conditional)
java.awt.EventDispatchThread.run()
Thread-1 <--- Frozen for at least 12s
sun.awt.windows.WToolkit.shutdown()
sun.awt.windows.WToolkit.access$200(WToolkit)
sun.awt.windows.WToolkit$2$1.run()
java.lang.Thread.run()
有谁知道可能是什么原因?