# Thread Dump erzeugen



## Thomas Darimont (17. Februar 2005)

Hallo!

Mit einem Thread Dump eines laufenden Java Prozesses kann man ein paar nützliche
Informationen der "aktuellen" Thread-Umgebung  ermitteln (Zustände der jeweiligen Threads
und deren Prioritäten.) Das ist zeitweilen sehr nützlich um irgendwelche Deadlocks aufzuspüren.

Dazu müss man einfach nur seine Java Anwendung über die Konsole bzw. mit der java.exe
(NICHT javaw.exe) starten und (an geeigneter Stelle) strg(ctrl) und pause (break) 
gleichzeitig drücken und anschließend ins Konsolenfenster schauen... ;-)

Beispiellauf:

```
H:\diplom\eclipse\workspace\training\bin>java de.tutorials.JTextAreaTest
Full thread dump Java HotSpot(TM) Client VM (1.5.0_01-b08 mixed mode, sharing):

"DestroyJavaVM" prio=5 tid=0x00236aa0 nid=0x6f8 waiting on condition [0x00000000..0x0006fae8]

"TimerQueue" daemon prio=5 tid=0x02d639a8 nid=0x12c in Object.wait() [0x0303f000..0x0303f9e4]
        at java.lang.Object.wait(Native Method)
        - waiting on <0x22b0d0c8> (a javax.swing.TimerQueue)
        at javax.swing.TimerQueue.run(TimerQueue.java:233)
        - locked <0x22b0d0c8> (a javax.swing.TimerQueue)
        at java.lang.Thread.run(Thread.java:595)

"AWT-EventQueue-0" prio=7 tid=0x02d070c0 nid=0x6e0 in Object.wait() [0x02fff000..0x02fffa64]
        at java.lang.Object.wait(Native Method)
        - waiting on <0x22fae3a0> (a java.awt.EventQueue)
        at java.lang.Object.wait(Object.java:474)
        at java.awt.EventQueue.getNextEvent(EventQueue.java:345)
        - locked <0x22fae3a0> (a java.awt.EventQueue)
        at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:189)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

"AWT-Windows" daemon prio=7 tid=0x02d01950 nid=0x71c runnable [0x02fbf000..0x02fbfae4]
        at sun.awt.windows.WToolkit.eventLoop(Native Method)
        at sun.awt.windows.WToolkit.run(WToolkit.java:269)
        at java.lang.Thread.run(Thread.java:595)

"AWT-Shutdown" prio=5 tid=0x02d01618 nid=0x6d8 in Object.wait() [0x02f7f000..0x02f7fb64]
        at java.lang.Object.wait(Native Method)
        - waiting on <0x22b304d8> (a java.lang.Object)
        at java.lang.Object.wait(Object.java:474)
        at sun.awt.AWTAutoShutdown.run(AWTAutoShutdown.java:259)
        - locked <0x22b304d8> (a java.lang.Object)
        at java.lang.Thread.run(Thread.java:595)

"Java2D Disposer" daemon prio=10 tid=0x009e9508 nid=0x784 in Object.wait() [0x02f3f000..0x02f3fbe4]
        at java.lang.Object.wait(Native Method)
        - waiting on <0x22b30560> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:116)
        - locked <0x22b30560> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:132)
        at sun.java2d.Disposer.run(Disposer.java:107)
        at java.lang.Thread.run(Thread.java:595)

"Low Memory Detector" daemon prio=5 tid=0x0099d7a8 nid=0x368 runnable [0x00000000..0x00000000]

"CompilerThread0" daemon prio=10 tid=0x0099c2a8 nid=0x33c waiting on condition [0x00000000..0x02c7f6bc]

"Signal Dispatcher" daemon prio=10 tid=0x0099b4e0 nid=0x700 waiting on condition [0x00000000..0x00000000]

"Finalizer" daemon prio=9 tid=0x009987c8 nid=0x760 in Object.wait() [0x02bff000..0x02bffa64]
        at java.lang.Object.wait(Native Method)
        - waiting on <0x22b30708> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:116)
        - locked <0x22b30708> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:132)
        at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159)

"Reference Handler" daemon prio=10 tid=0x009972b0 nid=0x648 in Object.wait() [0x02bbf000..0x02bbfae4]
        at java.lang.Object.wait(Native Method)
        - waiting on <0x22b30788> (a java.lang.ref.Reference$Lock)
        at java.lang.Object.wait(Object.java:474)
        at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:116)
        - locked <0x22b30788> (a java.lang.ref.Reference$Lock)

"VM Thread" prio=10 tid=0x00994a28 nid=0x6f0 runnable

"VM Periodic Task Thread" prio=10 tid=0x0099ed40 nid=0x720 waiting on condition
```

Gruß Tom


----------

