Hi Attila,
if your JavaScript is single threaded, you can stop the execution of the script 
as you want
(you also need that the exception used to stop the script to be non catchable)

or am i wrong ?

Rémi

----- Mail original -----
> De: "Attila Szegedi" <szege...@gmail.com>
> À: "Tomáš Zíma" <to...@tzima.cz>
> Cc: nashorn-dev@openjdk.java.net
> Envoyé: Mardi 23 Février 2016 02:36:09
> Objet: Re: time limit for compiled script
> 
> 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
> > 
> 
> 

Reply via email to