There isn’t, and really there couldn’t be - by definition any external stopping would stop the script at unpredictable time, right? It can’t really be safer than Thread.stop().
Nashorn compiles to JVM bytecode; it’s as suitable for stopped execution as any Java class’ code would be; which is to say, as well as with Thread.stop(). Attila. > On Feb 22, 2016, at 3:47 PM, Tomáš Zíma <to...@tzima.cz> wrote: > > Hello, > > is there any recommended way to kill (compiled) unresponsive script? In a > service we're running, pieces of JavaScript code are submitted by users and > introducing some limitations is absolutely necessary. I'd like to avoid using > deprecated stop() method on the thread, which is currently the only solution > I can think of. > > I know it's dangerous to forcefully stop the execution as it can leave the > application in an inconsistent or corrupted state (and that's why stop() is > deprecated), but this is something I can't deal with right now. > > Thank you. > -tzima >