7

I have a Tomcat running as a Windows Service, and those are known not to work well with jstack. jconsole is working well, on the other hand, and I can see stacks of individual threads (I'm connecting to "localhost:port" to access it).

How can I use jconsole or a similar tool to dump all the thread stacks into a file? (similar to jstack)

4

4 に答える 4

6

ThreadMXBean管理インターフェースを使用できます。

このFullThreadDumpクラスは、完全なスレッド ダンプを取得し、JMX を使用してリモートでデッドロックを検出する機能を示します。

于 2010-10-18T12:38:14.453 に答える
3

スタックダンプをファイルに書き込む別のコードサンプルを次に示します。

http://pastebin.com/zwcKC0hz

これをJMXで使用して、JMX要求を行ったとき、またはプロセスが予期しない高い負荷を検出した場合に取得するスタックダンプの概算を示します。

于 2010-10-18T13:30:26.603 に答える