Finding Source of Thread Creation in a Java application Finding Source of Thread Creation in a Java application multithreading multithreading

Finding Source of Thread Creation in a Java application


JProfiler can do that. The thread monitor view shows the stack trace where a thread was created - if CPU recording was active at that time:

enter image description here

Disclaimer: My company develops JProfiler


If using Eclipse and its debugger is an option, you might try the following:

  • Import the code into a Java project.
  • Ctrl-Shift-T (Open Type), enter "Thread". The binary source editor for the Thread class opens.
  • Select all the Thread constructors in the Outline view, use context menu "Toggle Method Breakpoint". That creates breakpoints for the constructors.
  • Run and debug.

Alternatively

You could get the Yourkit Java profiler, which is also available for evaluation. It can show the threads created in an application including their stack traces (also after the thread finished). It does not show where the threads were created, but the stack trace of the threads might give you some clues about the involved libraries.