Details
-
New Feature
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
WHY:
To allow proper sandboxing and let users run their own script, it is necessary to control the time a script is allowed to run and avoid runaway executions (for instance while(true); ).
WHAT:
Support for asynchronuous execution is usually based on Runnable/Callable/Future and Thread interruption. The Callable interface seems the most versatile so a method to transform a Script into a Callable seems in order. Thread interruption is in most cases an indication that must be checked (besides locking methods) somehow.
HOW:
Creating a Callable from a Script, Context (and arguments) is straightforward. Checking thread interruption can be performed in the Interpreter loop at "key" points namely getting/setting properties, calling methods/functions, resolving identifiers and of course, within loop constructs (for, while).
BACKGROUND:
http://apache-commons.680414.n4.nabble.com/jexl-JEXL-Secure-Sandbox-tt3626959.html