Subj : Rhino 1.5 script interrupt/terminate To : netscape.public.mozilla.jseng From : "rhino" Date : Wed Jan 22 2003 12:43 pm Rhino 1.5 exposes a callback method for Context: protected void observeInstructionCount(int instructionCount); the javadoc suggests "The method is useful to observe long running scripts and if necessary to terminate them." I would like to limit execution time on scripts to manage resources and kill infinite loop type conditions in a server environment. So with optimization set to -1 and setInstructionObserverThreshold set this method does indeed get invoked during script execution. The question is how to terminate the script. Thread.currentThread().interrupt() doesn't do it. Another approach I've tried that works is to call reportError("some message") from the observeInstructionCount method. This does the trick generating an EvaluatorException and exiting the script Seems like a hack and there should be a more direct way to do this. Comments? .