Kill the thread on the running VM (JBoss instance) using Java?
A bug in a third party library causes an infinite loop in the working thread on my JBoss instance Do you know how to kill this "stuck" thread without restarting the server? We want to be able to recover from this until the fix is deployed, preferably without restarting
I've seen some people mention using thread Interrupt () – if I want to write my own MBean code, how can I get a problematic thread to handle it for interruption?
Update: cannot be resolved using any of these methods I did meet another thread about the same issue, which has a link to why thread stop() is deprecated. Others have asked a similar question with similar results It seems that more complex containers should provide this health mechanism, but I guess their hands are associated with the JVM
Solution
I encountered a similar error in a third-party library (infinite loop) I finally applied the fix myself (waiting for someone from a third party lib to fix their mess) and then I modified it Put it on my In war, make sure it is loaded before forgery Class (forged third party. Jar)
This is not good but effective. Please look at my question:
Order of class loading from a . war file
I mean: if you have to wait for the person responsible for third-party eavesdropping lib to fix their things, you may wait a long time We can't afford it We need to fix it as soon as possible So we ended up applying patches / hackers to their code
For example, you can add a Boolean check to an infinite loop and force the loop to exit when you want the fake thread to "die"
Please note that I haven't used the deprecated thread stop() for ten years. I really don't want to use it in the above example