Kill a java thread from OS
We run application built by SAP which runs on IBM JRE.
I can get the thread level CPU usage using ps -mp <PID> -o THREAD
. Is there any similar way to kill a particular thread from OS (AIX 5.3)? May be some signal in kill
command?
I have heard that java debugger can may be used to kill threads randomly. Can so开发者_开发问答meone guide me where I can learn its usage best?
Even if you technically can do it, I would not recommend to do it, as the program, that includes the thread may not be prepared to handle this situation and then create random errors.
Just imagine the scenario where the thread in question holds a lock, so that other threads wait on the lock. Now when you kill the thread from outside, it will not release the lock and your app will just wait forever on release of the lock.
精彩评论