My problem is I want a full stack dump, so I need to obtain stack traces
from all threads, even those out of my control. Specifically, I would
like to obtain a stack thread from all Tomcat worker threads, and if
they are in a deadlock state, I cannot print their stack trace from
within them ;-)
I know it is technically possible, because there are some commercial
libraries that do it. For example, BEA systems seems to have an
implementation, as from their javadocs:
http://edocs.bea.com/wljrockit/docs142/jmapi/javadoc/Management%20API/com/bea/jvm/ThreadSystem.html
But I do not know if that implementation is only for their JRockit
virtual machine, or they use JNI to access internal JVM data, or if
there is something else involved.
I am implementing a rather complex server, and detecting / reporting a
deadlock condition would be a great advantage in the development process.
Anyway, thanks for your comments :-)
Thomas Kellerer wrote:
> Rodrigo Ruiz schrieb:
>
>> Hi all, is there any way to get a stack trace of a given thread?
>>
>> I want to obtain a full thread stack dump from a JSP, just like the
>> one obtained via kill -QUIT, but I do not find any method in the
>> Thread class that could be used to get this information.
>>
>> I seem to recall that some code was posted some time ago in this
>> list, but I have not found it in the archives. Any ideas?
>>
>> PS: What I really want to do is a tool for detecting deadlocks via
>> thread dump analysis :-)
>
>
> Create an exception within that thread, and write it's stack dump via
> a StringWriter into a String
>
> Thomas
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
> For additional commands, e-mail: tomcat-user-help@(protected)
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
For additional commands, e-mail: tomcat-user-help@(protected)