Java Swing 1.6 обновляет 23 блокировки JVM с помощью апплета - PullRequest
2 голосов
/ 31 мая 2011

В настоящее время у меня есть апплет, и только недавно обнаружена проблема с ним, иногда вся JVM блокируется и перестает отвечать, включая консоль Java.

Любой код в апплете, который у меня обновляет пользовательский интерфейс,запустить в потоке отправки событий.Когда JVM заблокирован, я использовал JVisualVM, чтобы обеспечить дамп потока JVM.Я прилагаю вывод его ниже.Из того, что я вижу, есть 3 очереди событий, но больше беспокоит то, что я думаю, что есть два потока EventDispatch, которые взаимно блокируют друг друга в Deadly Embrace.

Сценарий в апплете следующийпользователь хочет просмотреть текстовое поле, поэтому мы запускаем окно обзора, размещенное в окне JInternalFrame, пользователь выбирает желаемое значение, а затем это значение вставляется в TextField и окно просмотра закрывается.

Из того, что я могу видеть, является то, что поток AWT-EventQueue-2 обновляет поле в EDT и получил writeLock в javax.swing.text.AbstractDocument.replace () и пытается аннулировать текстовое поле, но ждет, пока поток AWT-EventQueue-0 освобождает древовидную блокировку, однако AWT-EventQueue-0 ожидает чтения блокировки () в том же поле, но не будет прогрессировать до тех пор, пока поток AWT-EventQueue-2 не снимет блокировку записи, следовательно, взаимную блокировку.Что я не понимаю, так это то, как будто есть как минимум 2 EDT.

Я знаю, что я, вероятно, глупо здесь, но может кто-нибудь пролить свет на эту проблему.Заранее спасибо.

Мой вопрос здесь, вы считаете, что это ошибка JVM

Интересующие темы: AWT-EventQueue-1, AWT-EventQueue-2 и AWT-EventQueue-0.

2011-05-26 12:32:43
Full thread dump Java HotSpot(TM) Client VM (19.0-b09 mixed mode, sharing):

"JMX server connection timeout 1480" daemon prio=6 tid=0x048d0800 nid=0xbac in Object.wait() [0x056ef000]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    at com.sun.jmx.remote.internal.ServerCommunicatorAdmin$Timeout.run(Unknown Source)
    - locked  (a [I)
    at java.lang.Thread.run(Unknown Source)

   Locked ownable synchronizers:
    - None

"RMI Scheduler(0)" daemon prio=6 tid=0x04a72800 nid=0xf74 waiting on condition [0x047cf000]
   java.lang.Thread.State: TIMED_WAITING (parking)
    at sun.misc.Unsafe.park(Native Method)
    - parking to wait for   (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
    at java.util.concurrent.locks.LockSupport.parkNanos(Unknown Source)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(Unknown Source)
    at java.util.concurrent.DelayQueue.take(Unknown Source)
    at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(Unknown Source)
    at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.getTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

   Locked ownable synchronizers:
    - None

"RMI TCP Connection(2)-172.16.10.136" daemon prio=6 tid=0x0494c800 nid=0x7b8 runnable [0x0462f000]
   java.lang.Thread.State: RUNNABLE
    at java.net.SocketInputStream.socketRead0(Native Method)
    at java.net.SocketInputStream.read(Unknown Source)
    at java.io.BufferedInputStream.fill(Unknown Source)
    at java.io.BufferedInputStream.read(Unknown Source)
    - locked  (a java.io.BufferedInputStream)
    at java.io.FilterInputStream.read(Unknown Source)
    at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Source)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

   Locked ownable synchronizers:
    -  (a java.util.concurrent.locks.ReentrantLock$NonfairSync)

"RMI TCP Accept-0" daemon prio=6 tid=0x050b0400 nid=0x860 runnable [0x036df000]
   java.lang.Thread.State: RUNNABLE
    at java.net.PlainSocketImpl.socketAccept(Native Method)
    at java.net.PlainSocketImpl.accept(Unknown Source)
    - locked  (a java.net.SocksSocketImpl)
    at java.net.ServerSocket.implAccept(Unknown Source)
    at java.net.ServerSocket.accept(Unknown Source)
    at sun.management.jmxremote.LocalRMIServerSocketFactory$1.accept(Unknown Source)
    at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.executeAcceptLoop(Unknown Source)
    at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

   Locked ownable synchronizers:
    - None

"NativeSwing Receiver - Swing" daemon prio=4 tid=0x04aafc00 nid=0x164 runnable [0x0471f000]
   java.lang.Thread.State: RUNNABLE
    at java.net.SocketInputStream.socketRead0(Native Method)
    at java.net.SocketInputStream.read(Unknown Source)
    at java.io.BufferedInputStream.fill(Unknown Source)
    at java.io.BufferedInputStream.read(Unknown Source)
    - locked  (a java.io.BufferedInputStream)
    at java.io.ObjectInputStream$PeekInputStream.peek(Unknown Source)
    at java.io.ObjectInputStream$BlockDataInputStream.peek(Unknown Source)
    at java.io.ObjectInputStream$BlockDataInputStream.peekByte(Unknown Source)
    at java.io.ObjectInputStream.readObject0(Unknown Source)
    at java.io.ObjectInputStream.readUnshared(Unknown Source)
    at chrriis.dj.nativeswing.swtimpl.OutProcessSocketsMessagingInterface.readMessageFromChannel(OutProcessSocketsMessagingInterface.java:113)
    at chrriis.dj.nativeswing.swtimpl.MessagingInterface$2.run(MessagingInterface.java:361)

   Locked ownable synchronizers:
    - None

"NativeSwing Stream Connector" daemon prio=4 tid=0x04915800 nid=0xf04 runnable [0x0569f000]
   java.lang.Thread.State: RUNNABLE
    at java.io.FileInputStream.readBytes(Native Method)
    at java.io.FileInputStream.read(Unknown Source)
    at java.io.BufferedInputStream.fill(Unknown Source)
    at java.io.BufferedInputStream.read1(Unknown Source)
    at java.io.BufferedInputStream.read(Unknown Source)
    - locked  (a java.io.BufferedInputStream)
    at java.io.FilterInputStream.read(Unknown Source)
    at chrriis.dj.nativeswing.swtimpl.NativeInterface$OutProcess$1.run(NativeInterface.java:801)

   Locked ownable synchronizers:
    - None

"NativeSwing Stream Connector" daemon prio=4 tid=0x03330400 nid=0xe24 runnable [0x0564f000]
   java.lang.Thread.State: RUNNABLE
    at java.io.FileInputStream.readBytes(Native Method)
    at java.io.FileInputStream.read(Unknown Source)
    at java.io.BufferedInputStream.read1(Unknown Source)
    at java.io.BufferedInputStream.read(Unknown Source)
    - locked  (a java.io.BufferedInputStream)
    at java.io.BufferedInputStream.fill(Unknown Source)
    at java.io.BufferedInputStream.read1(Unknown Source)
    at java.io.BufferedInputStream.read(Unknown Source)
    - locked  (a java.io.BufferedInputStream)
    at java.io.FilterInputStream.read(Unknown Source)
    at chrriis.dj.nativeswing.swtimpl.NativeInterface$OutProcess$1.run(NativeInterface.java:801)

   Locked ownable synchronizers:
    - None

"WebServer" daemon prio=4 tid=0x0489b400 nid=0xfc8 runnable [0x055ff000]
   java.lang.Thread.State: RUNNABLE
    at java.net.PlainSocketImpl.socketAccept(Native Method)
    at java.net.PlainSocketImpl.accept(Unknown Source)
    - locked  (a java.net.SocksSocketImpl)
    at java.net.ServerSocket.implAccept(Unknown Source)
    at java.net.ServerSocket.accept(Unknown Source)
    at chrriis.common.WebServer$1.run(WebServer.java:720)

   Locked ownable synchronizers:
    - None

"Registry cleanup thread" daemon prio=4 tid=0x04ad9400 nid=0xf94 waiting on condition [0x055af000]
   java.lang.Thread.State: TIMED_WAITING (sleeping)
    at java.lang.Thread.sleep(Native Method)
    at chrriis.common.ObjectRegistry$1.run(ObjectRegistry.java:31)

   Locked ownable synchronizers:
    - None

"Registry cleanup thread" daemon prio=4 tid=0x04c37400 nid=0x2e4 waiting on condition [0x054df000]
   java.lang.Thread.State: TIMED_WAITING (sleeping)
    at java.lang.Thread.sleep(Native Method)
    at chrriis.common.ObjectRegistry$1.run(ObjectRegistry.java:31)

   Locked ownable synchronizers:
    - None

"TimerQueue" daemon prio=4 tid=0x03378000 nid=0xa0 in Object.wait() [0x0486f000]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    at javax.swing.TimerQueue.run(Unknown Source)
    - locked  (a javax.swing.TimerQueue)
    at java.lang.Thread.run(Unknown Source)

   Locked ownable synchronizers:
    - None

"ConsoleWriterThread" daemon prio=6 tid=0x032b1400 nid=0x398 in Object.wait() [0x0476f000]
   java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    at java.lang.Object.wait(Object.java:485)
    at com.sun.deploy.util.ConsoleTraceListener$ConsoleWriterThread.run(Unknown Source)
    - locked  (a java.lang.Object)

   Locked ownable synchronizers:
    - None

"Windows Tray Icon Thread" prio=6 tid=0x032a7800 nid=0xdbc runnable [0x046cf000]
   java.lang.Thread.State: RUNNABLE
    at com.sun.deploy.ui.WindowsJavaTrayIcon.mainLoop(Native Method)
    at com.sun.deploy.ui.WindowsJavaTrayIcon.access$700(Unknown Source)
    at com.sun.deploy.ui.WindowsJavaTrayIcon$2.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

   Locked ownable synchronizers:
    - None

"TimerQueue" daemon prio=6 tid=0x032a2800 nid=0xf78 in Object.wait() [0x0467f000]
   java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    - waiting on  (a javax.swing.TimerQueue)
    at javax.swing.TimerQueue.run(Unknown Source)
    - locked  (a javax.swing.TimerQueue)
    at java.lang.Thread.run(Unknown Source)

   Locked ownable synchronizers:
    - None

"thread applet-ClientApplet.class-1" prio=4 tid=0x03281400 nid=0x85c in Object.wait() [0x045df000]
   java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    - waiting on  (a java.lang.Object)
    at java.lang.Object.wait(Object.java:485)
    at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
    - locked  (a java.lang.Object)
    at java.lang.Thread.run(Unknown Source)

   Locked ownable synchronizers:
    - None

"AWT-EventQueue-1" prio=6 tid=0x0325b400 nid=0xe94 waiting for monitor entry [0x0457f000]
   java.lang.Thread.State: BLOCKED (on object monitor)
    at javax.swing.JComponent.paintChildren(Unknown Source)
    - waiting to lock  (a java.awt.Component$AWTTreeLock)
    at javax.swing.JComponent.paint(Unknown Source)
    at javax.swing.JComponent.paintToOffscreen(Unknown Source)
    at javax.swing.BufferStrategyPaintManager.paint(Unknown Source)
    at javax.swing.RepaintManager.paint(Unknown Source)
    at javax.swing.JComponent._paintImmediately(Unknown Source)
    at javax.swing.JComponent.paintImmediately(Unknown Source)
    at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
    at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
    at javax.swing.RepaintManager.seqPaintDirtyRegions(Unknown Source)
    at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source)
    at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)

   Locked ownable synchronizers:
    - None

"AWT-EventQueue-2" prio=4 tid=0x03259800 nid=0xb0c waiting for monitor entry [0x0363f000]
   java.lang.Thread.State: BLOCKED (on object monitor)
    at java.awt.Component.invalidate(Unknown Source)
    - waiting to lock  (a java.awt.Component$AWTTreeLock)
    at java.awt.Container.invalidate(Unknown Source)
    at javax.swing.JComponent.revalidate(Unknown Source)
    at javax.swing.plaf.basic.BasicTextUI$RootView.preferenceChanged(Unknown Source)
    at javax.swing.text.View.preferenceChanged(Unknown Source)
    at javax.swing.text.PlainView.updateDamage(Unknown Source)
    at javax.swing.text.PlainView.removeUpdate(Unknown Source)
    at javax.swing.text.FieldView.removeUpdate(Unknown Source)
    at javax.swing.plaf.basic.BasicTextUI$RootView.removeUpdate(Unknown Source)
    at javax.swing.plaf.basic.BasicTextUI$UpdateHandler.removeUpdate(Unknown Source)
    at javax.swing.text.AbstractDocument.fireRemoveUpdate(Unknown Source)
    at javax.swing.text.AbstractDocument.handleRemove(Unknown Source)
    at javax.swing.text.AbstractDocument.remove(Unknown Source)
    at javax.swing.text.AbstractDocument.replace(Unknown Source)
    at javax.swing.text.JTextComponent.setText(Unknown Source)
    at JCFTextField.setFieldData(Unknown Source)
    at JCFTextField.JC_setData(Unknown Source)
    at CTetraAppCommsCallBack.JC_SetData(Unknown Source)
    at ClientCommsManager.processComponentMsg(Unknown Source)
    at ClientCommsManager.commsInput(Unknown Source)
    at HTTPCommsThread$2.run(Unknown Source)
    at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)

   Locked ownable synchronizers:
    - None

"Applet 1 LiveConnect Worker Thread" prio=4 tid=0x03261800 nid=0xe3c in Object.wait() [0x044df000]
   java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    at java.lang.Object.wait(Object.java:485)
    at sun.plugin2.main.client.LiveConnectSupport$PerAppletInfo$LiveConnectWorker.run(Unknown Source)
    - locked  (a java.lang.Object)
    at java.lang.Thread.run(Unknown Source)

   Locked ownable synchronizers:
    - None

"Browser Side Object Cleanup Thread" prio=6 tid=0x03255800 nid=0x29c in Object.wait() [0x037ff000]
   java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    - waiting on  (a java.lang.ref.ReferenceQueue$Lock)
    at java.lang.ref.ReferenceQueue.remove(Unknown Source)
    - locked  (a java.lang.ref.ReferenceQueue$Lock)
    at java.lang.ref.ReferenceQueue.remove(Unknown Source)
    at sun.plugin2.main.client.LiveConnectSupport$BrowserSideObjectCleanupThread.run(Unknown Source)

   Locked ownable synchronizers:
    - None

"CacheCleanUpThread" daemon prio=6 tid=0x0322d000 nid=0x86c in Object.wait() [0x0377f000]
   java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    - waiting on  (a com.sun.deploy.cache.CleanupThread)
    at java.lang.Object.wait(Object.java:485)
    at com.sun.deploy.cache.CleanupThread.run(Unknown Source)
    - locked  (a com.sun.deploy.cache.CleanupThread)

   Locked ownable synchronizers:
    - None

"CacheMemoryCleanUpThread" daemon prio=6 tid=0x03227c00 nid=0x554 in Object.wait() [0x0372f000]
   java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    at java.lang.ref.ReferenceQueue.remove(Unknown Source)
    - locked  (a java.lang.ref.ReferenceQueue$Lock)
    at java.lang.ref.ReferenceQueue.remove(Unknown Source)
    at com.sun.deploy.cache.MemoryCache$LoadedResourceCleanupThread.run(Unknown Source)

   Locked ownable synchronizers:
    - None

"Java Plug-In Heartbeat Thread" prio=6 tid=0x02d66c00 nid=0xdcc waiting on condition [0x034af000]
   java.lang.Thread.State: TIMED_WAITING (sleeping)
    at java.lang.Thread.sleep(Native Method)
    at sun.plugin2.main.client.PluginMain$HeartbeatThread.run(Unknown Source)

   Locked ownable synchronizers:
    - None

"AWT-EventQueue-0" prio=6 tid=0x02d6e400 nid=0xd9c in Object.wait() [0x0368d000]
   java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    at java.lang.Object.wait(Object.java:485)
    at javax.swing.text.AbstractDocument.readLock(Unknown Source)
    - locked  (a javax.swing.text.PlainDocument)
    at javax.swing.plaf.basic.BasicTextUI.paint(Unknown Source)
    at javax.swing.plaf.basic.BasicTextUI.update(Unknown Source)
    at javax.swing.JComponent.paintComponent(Unknown Source)
    at javax.swing.JComponent.paint(Unknown Source)
    at javax.swing.JComponent.paintChildren(Unknown Source)
    - locked  (a java.awt.Component$AWTTreeLock)
    at javax.swing.JComponent.paint(Unknown Source)
    at javax.swing.JLayeredPane.paint(Unknown Source)
    at javax.swing.JComponent.paintChildren(Unknown Source)
    - locked  (a java.awt.Component$AWTTreeLock)
    at javax.swing.JComponent.paint(Unknown Source)
    at javax.swing.JLayeredPane.paint(Unknown Source)
    at javax.swing.JComponent.paintChildren(Unknown Source)
    - locked  (a java.awt.Component$AWTTreeLock)
    at javax.swing.JComponent.paint(Unknown Source)
    at javax.swing.JLayeredPane.paint(Unknown Source)
    at javax.swing.JComponent.paintChildren(Unknown Source)
    - locked  (a java.awt.Component$AWTTreeLock)
    at javax.swing.JComponent.paint(Unknown Source)
    at javax.swing.JViewport.paint(Unknown Source)
    at javax.swing.JComponent.paintChildren(Unknown Source)
    - locked  (a java.awt.Component$AWTTreeLock)
    at javax.swing.JComponent.paint(Unknown Source)
    at javax.swing.JComponent.paintChildren(Unknown Source)
    - locked  (a java.awt.Component$AWTTreeLock)
    at javax.swing.JComponent.paint(Unknown Source)
    at javax.swing.JComponent.paintChildren(Unknown Source)
    - locked  (a java.awt.Component$AWTTreeLock)
    at javax.swing.JComponent.paint(Unknown Source)
    at javax.swing.JLayeredPane.paint(Unknown Source)
    at javax.swing.JComponent.paintChildren(Unknown Source)
    - locked  (a java.awt.Component$AWTTreeLock)
    at javax.swing.JComponent.paint(Unknown Source)
    at javax.swing.JComponent.paintChildren(Unknown Source)
    - locked  (a java.awt.Component$AWTTreeLock)
    at javax.swing.JComponent.paint(Unknown Source)
    at javax.swing.JLayeredPane.paint(Unknown Source)
    at javax.swing.JComponent.paintChildren(Unknown Source)
    - locked  (a java.awt.Component$AWTTreeLock)
    at javax.swing.JSplitPane.paintChildren(Unknown Source)
    at javax.swing.JComponent.paint(Unknown Source)
    at javax.swing.JComponent.paintChildren(Unknown Source)
    - locked  (a java.awt.Component$AWTTreeLock)
    at javax.swing.JComponent.paint(Unknown Source)
    at javax.swing.JComponent.paintChildren(Unknown Source)
    - locked  (a java.awt.Component$AWTTreeLock)
    at javax.swing.JComponent.paint(Unknown Source)
    at javax.swing.JComponent.paintChildren(Unknown Source)
    - locked  (a java.awt.Component$AWTTreeLock)
    at javax.swing.JComponent.paint(Unknown Source)
    at javax.swing.JComponent.paintChildren(Unknown Source)
    - locked  (a java.awt.Component$AWTTreeLock)
    at javax.swing.JComponent.paint(Unknown Source)
    at javax.swing.JComponent.paintToOffscreen(Unknown Source)
    at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(Unknown Source)
    at javax.swing.RepaintManager$PaintManager.paint(Unknown Source)
    at javax.swing.BufferStrategyPaintManager.paint(Unknown Source)
    at javax.swing.RepaintManager.paint(Unknown Source)
    at javax.swing.JComponent._paintImmediately(Unknown Source)
    at javax.swing.JComponent.paintImmediately(Unknown Source)
    at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
    at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
    at javax.swing.RepaintManager.seqPaintDirtyRegions(Unknown Source)
    at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source)
    at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)

   Locked ownable synchronizers:
    - None

"AWT-Windows" daemon prio=6 tid=0x02cea800 nid=0x568 runnable [0x00a2f000]
   java.lang.Thread.State: RUNNABLE
    at sun.awt.windows.WToolkit.eventLoop(Native Method)
    at sun.awt.windows.WToolkit.run(Unknown Source)

   Locked ownable synchronizers:
    - None

"AWT-Shutdown" prio=6 tid=0x02ce9c00 nid=0x608 in Object.wait() [0x0359f000]
   java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    at java.lang.Object.wait(Object.java:485)
    at sun.awt.AWTAutoShutdown.run(Unknown Source)
    - locked  (a java.lang.Object)
    at java.lang.Thread.run(Unknown Source)

   Locked ownable synchronizers:
    - None

"Java2D Disposer" daemon prio=10 tid=0x02ccb800 nid=0x524 in Object.wait() [0x0354f000]
   java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    at java.lang.ref.ReferenceQueue.remove(Unknown Source)
    - locked  (a java.lang.ref.ReferenceQueue$Lock)
    at java.lang.ref.ReferenceQueue.remove(Unknown Source)
    at sun.java2d.Disposer.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

   Locked ownable synchronizers:
    - None

"Java Plug-In Pipe Worker Thread (Client-Side)" daemon prio=6 tid=0x0321c400 nid=0xbec runnable [0x034ff000]
   java.lang.Thread.State: RUNNABLE
    at sun.plugin2.os.windows.Windows.ReadFile0(Native Method)
    at sun.plugin2.os.windows.Windows.ReadFile(Unknown Source)
    at sun.plugin2.ipc.windows.WindowsNamedPipe.read(Unknown Source)
    at sun.plugin2.message.transport.NamedPipeTransport$SerializerImpl.read(Unknown Source)
    at sun.plugin2.message.transport.NamedPipeTransport$SerializerImpl.readByte(Unknown Source)
    at sun.plugin2.message.AbstractSerializer.readInt(Unknown Source)
    at sun.plugin2.message.transport.SerializingTransport.read(Unknown Source)
    at sun.plugin2.message.Pipe$WorkerThread.run(Unknown Source)

   Locked ownable synchronizers:
    - None

"Timer-0" prio=6 tid=0x02d65c00 nid=0x4e8 in Object.wait() [0x0345f000]
   java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    - waiting on  (a java.util.TaskQueue)
    at java.lang.Object.wait(Object.java:485)
    at java.util.TimerThread.mainLoop(Unknown Source)
    - locked  (a java.util.TaskQueue)
    at java.util.TimerThread.run(Unknown Source)

   Locked ownable synchronizers:
    - None

"traceMsgQueueThread" daemon prio=6 tid=0x02cef400 nid=0xb14 in Object.wait() [0x031cf000]
   java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    at java.lang.Object.wait(Object.java:485)
    at com.sun.deploy.util.Trace$TraceMsgQueueChecker.run(Unknown Source)
    - locked  (a java.util.ArrayList)
    at java.lang.Thread.run(Unknown Source)

   Locked ownable synchronizers:
    - None

"Low Memory Detector" daemon prio=6 tid=0x02c9e400 nid=0x834 runnable [0x00000000]
   java.lang.Thread.State: RUNNABLE

   Locked ownable synchronizers:
    - None

"CompilerThread0" daemon prio=10 tid=0x02c98800 nid=0xf0c waiting on condition [0x00000000]
   java.lang.Thread.State: RUNNABLE

   Locked ownable synchronizers:
    - None

"Attach Listener" daemon prio=10 tid=0x02c96c00 nid=0xec waiting on condition [0x00000000]
   java.lang.Thread.State: RUNNABLE

   Locked ownable synchronizers:
    - None

"Signal Dispatcher" daemon prio=10 tid=0x02c95800 nid=0x464 runnable [0x00000000]
   java.lang.Thread.State: RUNNABLE

   Locked ownable synchronizers:
    - None

"Finalizer" daemon prio=8 tid=0x02c8e800 nid=0x900 in Object.wait() [0x02e5f000]
   java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    at java.lang.ref.ReferenceQueue.remove(Unknown Source)
    - locked  (a java.lang.ref.ReferenceQueue$Lock)
    at java.lang.ref.ReferenceQueue.remove(Unknown Source)
    at java.lang.ref.Finalizer$FinalizerThread.run(Unknown Source)

   Locked ownable synchronizers:
    - None

"Reference Handler" daemon prio=10 tid=0x02c8d400 nid=0x71c in Object.wait() [0x02e0f000]
   java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    at java.lang.Object.wait(Object.java:485)
    at java.lang.ref.Reference$ReferenceHandler.run(Unknown Source)
    - locked  (a java.lang.ref.Reference$Lock)

   Locked ownable synchronizers:
    - None

"main" prio=6 tid=0x002a8000 nid=0x380 in Object.wait() [0x0090f000]
   java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    at sun.plugin2.message.Queue.waitForMessage(Unknown Source)
    - locked  (a sun.plugin2.message.Queue)
    at sun.plugin2.message.Pipe.receive(Unknown Source)
    at sun.plugin2.main.client.PluginMain.mainLoop(Unknown Source)
    at sun.plugin2.main.client.PluginMain.run(Unknown Source)
    at sun.plugin2.main.client.PluginMain.main(Unknown Source)

   Locked ownable synchronizers:
    - None

"VM Thread" prio=10 tid=0x02c8bc00 nid=0x814 runnable 

"VM Periodic Task Thread" prio=10 tid=0x02ca9400 nid=0x4bc waiting on condition 

JNI global references: 2569

1 Ответ

0 голосов
/ 13 июля 2011

В следе параллелизма Java объясняется, что доступ к компонентам Swing и их моделям должен происходить в EDT.Тем не менее, он не в состоянии решить, что происходит, когда у вас есть несколько EDT.

Лучшая формулировка "всегда обращаться к компонентам качания из EDT" , вероятно, такова: "всегда обращаться к компонентам качания из ровно одного EDT".

Классы chrriis.dj.nativeswing.swtimpl, используемые апплетом в JInternalFrame, создают еще один EDT.

Тупик возникает, когда EDT # 2 (внутренний фрейм) обновляет текстовое поле ив то же время EDT # 0 (апплет) пытается перекрасить одно и то же текстовое поле.

Решение состоит в том, чтобы не передавать какой-либо компонент Swing или их модели между EDT.Вместо этого используйте BlockingQueue с внутренней рамкой в ​​качестве производителя и SwingWorker (запущенный апплетом) в качестве потребителя.Как только SwingWorker считывает обновление из BlockingQueue, он может передать данные обратно в EDT с помощью метода done.Если вам нужно опубликовать промежуточные результаты, используйте методы publish и process

...