3

Possible Duplicate:
Can I get the name of the class and method within which the current thread was spawned?

Are there any tools (perhaps a javaagent) that will let me identify what started a thread after the event?

I have a Tomcat that won't shut down, and the thread names (from the dump) aren't of much use.

Community
  • 1
  • 1
Rich
  • 15,602
  • 15
  • 79
  • 126

2 Answers2

0

The lowest level call of a stack trace might indicate how/why a thread was started...

dcn
  • 4,389
  • 2
  • 30
  • 39
0

Do one thing, print the stack trace, and you will get who started the thread.

Saurabh Gokhale
  • 53,625
  • 36
  • 139
  • 164
  • You don't have to print it. It's available from a getter: [Thread.currentThread().getStackTrace()](http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Thread.html#getStackTrace()) since 1.5 – Bohemian Sep 16 '11 at 12:46
  • Does `tomcat` do something special here? Otherwise, the stacktrace stops at `Thread.run` – Miserable Variable Sep 16 '11 at 12:47
  • 1
    I already have the stack trace (hence my comment saying I had the dump) but that doesn't give any useful information. – Rich Sep 16 '11 at 12:48