From:  "" <>
Date:  24 Sep 2006 22:48:07 Hong Kong Time

Rhino/Java - terminating script execution without affecting executing thread


Hello, I am working on embedding rhino within a java server application
that will allow js functions to override default behavior of objects.
Each js execution will need to execute under its own thread, and I
would love to be able to use a thread pool (ala ThreadPoolExecutor) to
reuse the threads for multiple script executions.  Also, a major
requirement is being able to control a script's execution to avoid
things like infinite loops that would hog CPU time/threads.

So the crux of the issue is can I prematurely terminate a script's
execution without affecting the life cycle of the thread running it so
that the thread can be reused to run other scripts in the future?  Is
there a built in mechanism in the API for doing this?