How to find what called a thread



  • In the Eclipse debugger, I see in the stack trace many calls to Thread.run. The steps never go beyond that. How do I find out what method in our code started the thread? Right-clicking does not provide anything useful. Putting a breakpoint on the run method in Thread.class and inspecting Target does not, as far as I can tell, say who the caller is.



  • @tharpa as far as I know you'll have to create your own thing to preserve this information. A new thread gets an entire new stack, so you'll never get this information on a stack trace.


  • Discourse touched me in a no-no place

    @tharpa said in How to find what called a thread:

    I see in the stack trace many calls to Thread.run. The steps never go beyond that. How do I find out what method in our code started the thread?

    There's almost nothing in that method. It's seriously trivial. Have those threads actually been started yet? (Can you check what the thread's state property is?)


Log in to reply