multithreading - How to kill deadlocked threads in Java? -


I want to kill those threads that are stuck in the deadlock situation. First of all, we can use the findDeadlockedThreads () method of ThreadMXBean class in java.lang.management .

Then, I want to kill thread with thread id, and thus I have two related questions:
(1) How to get a thread control from thread id?
(2) How can I kill the blocked thread? I think the invoking interrupt () method will give an exception to the thread and kill the thread.

From the root thread group, you may have a thread class. After that you can match thread ID to your ID.

After saying this, it is very dangerous due to the ability to leave objects in an inconsistent state. I do not believe that in the middle, the method will create a thread to free the person who is stuck in waiting on the sync lock, so (preventing evil) methods

Also see: ""


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -