Is it too risky to call Thread.stop on a runaway GroovyShell server thread? Is it too risky to call Thread.stop on a runaway GroovyShell server thread? multithreading multithreading

Is it too risky to call Thread.stop on a runaway GroovyShell server thread?


I think that generally is it bad to use deprecated API and specifically it is not recommended to use Thread.stop().

BUT there is not rule without exception. I think this is the case. According to my experience Thread.stop() works and really stops thread. I used it many years ago in applet that was targeted for Netscape. Some of its versions did not support Thread.interrupt() well.

The only alternative solution I can think about is using separate process. But in this case you have to implement some process-to-process transport for data transfer. I do not know details of your task but usually the price is too high.

So, if I were you I'd use Thread.stop() with very big apologize comment.