Trigger readable stack traces for all running threads (i.e., Thread Dump)

Marcelo Rodrigues Costa marcelorjava at gmail.com
Wed Aug 21 03:46:52 PDT 2013


Hi everyone, quick question that started in a twitter discussion:

Thanks to Marcus I discovered that '-dump-on-error' generates a readable
Java/Javascript stack trace, but it only happens when something fails, I
managed to trigger my own stack trace by creating a new Exception and using
the 'printStackTrace()' method but looks like both approaches only focus on
the running Thread.

Here's a crazy idea: create a managed bean that would receive JMX commands
to trigger the "thread dump" by accessing all the threads that would be
referenced in a Thread Group, the threads will actually be created within a
wrapper that would contain a method to run "new
Exception().printStackTrace()" and append this with t.getState() so we can
keep track of the state of all threads on that given monitor (we would also
need a new Thread Dump Analyzer to parse this format.. or add a new set of
regex logic to the known ones like Threadlogic).

Yeah... it seems really messy, thoughts?

Kind regards,
--
Marcelo R.



-- 
Marcelo Rodrigues


More information about the nashorn-dev mailing list