IntelliJ Thread Debug
Solution 1
I think you can. I have suspended threads via breakpoints by setting the suspend policy. This will suspend the thread that is executing this piece of code. If you have multiple thread then I would think they would carry on.
To quote the suspend policy
- Item Description
- All : When the breakpoint is hit, all threads are suspended
- Thread : When the breakpoint is hit, the thread where the breakpoint is hit is suspended.
- None: No thread is suspended.
Solution 2
You have a nice Threads
view available.
Press the little gearwheel and you will see all active threads.
And on each breakpoint you can set the Suspend Policy. You can either make the Thread
alternative the default for all breakpoints or you can set them individually on each breakpoint.
Solution 3
For me the problem with not accessing thread still occcurs. I set up brakepoints to all. And put brakepoints inside calling methods. What I noticed is that the method in new thread is beeing accessed when i call run() but not start(). Just wondering why, AFAIK the start() method should call run(). Nevertheless, the output from thread occurs even I call .start(), but never access it.
Dane Balia
Updated on July 09, 2022Comments
-
Dane Balia almost 2 years
Does IntelliJ IDEA provide thread-debugging? That is - Netbeans allows you to debug multiple threads, and halting at those breakpoints (automatically). However all I seem to be getting in IntelliJ is "thread dumping", which seems to be an analysis that is manual, and a snapshot taken when I clicked 'Thread Dump'.
Is there something I'm missing? I have google'd and not found sufficient information to assist.
-
Dane Balia over 11 yearsThanks - I did alter the "suspend policy" and even made the default to "Thread" - but still no suspension. I then spawned just'one' thread, (commented out the second) - and still there is no breakpoint. When I do a thread dump, I do see an error - but I have a breakpoint before that line. This is weird. You have any ideas?
-
RNJ over 11 yearsHow are you building/running? At times when I deploy my code can be out of date to what is deployed. If that happens then my breakpoints go really funny...
-
Dane Balia over 11 yearsYou right - it's working now. Did a proper build and all is well. Thanks guys. also made all breakpoints default to 'Thread'
-
Dane Balia over 11 yearsThe real reason for the problem was that I had created a whole bunch of breakpoints prior to setting the suspend policy, and even though I set "default" to Thread, the old breakpoints were set to "All". I had to manually reset them to the default. That WORKED! So that was IT!
-
Lena Bru almost 10 yearsif you call run() the method runs synchronously, and when you call start the method run, runs asynchronously , when the method is run async the thread doesnt stop at the breakpoint for some reason