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

I would like to add groovy-shell-server to our application. Recently, we have encountered several production problems when calling the internal API can speed up diagnostics or even provide a short-term fix. Groovy -shell-server provides a good way to achieve this.

But actually using this in production introduces a potential complication. Let's say that, despite a thorough peer review, we execute a script that binds the processor or gets stuck in an infinite loop. I need to somehow kill this thread, prono! So I was thinking of improving Groovy -shell-server to support the optional hard stop () of the Groovy client workflow.

I know that Thread.stop () is inherently unsafe ; he was qaru.site/questions/131457 / ... . My question is: do you think that the benefits can outweigh the risks in this case? Does Thread.stop () use a pragmatic choice as a kind of "emergency brake" for GroovyShell running server thread? Or is the likelihood that objects remain in an inconsistent state too high?

(Alternatively, if someone has a better way to provide programmatic, interrupted access to a running Java application, I’m all ears.)

+5
source share
1 answer

, API , , Thread.stop().

. , . Thread.stop() . , Netscape. Thread.interrupt().

, , - . . , .

, , Thread.stop() .

+4

All Articles