Commons JEXL
  1. Commons JEXL
  2. JEXL-115

Add support for asynchronous script execution and cancellation

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.1
    • Labels:
      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

        Activity

        Henri Biestro created issue -
        Henri Biestro committed 1146477 (5 files)
        Reviews: none

        JEXL-115
        * Added method to create Callable in/from Script (as well as JEXL-114 related getVariables, getParameters, getLocalVariables)
        * Added checks in Interpreter wrt thread interruption
        * Added specific exception to let the Interpreter unwind its stack under cancellation
        * Added tests

        Henri Biestro made changes -
        Field Original Value New Value
        Issue Type Improvement [ 4 ] New Feature [ 2 ]
        Hide
        Henri Biestro added a comment -

        Committed revision 1147698.

        Show
        Henri Biestro added a comment - Committed revision 1147698.
        Henri Biestro made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Henri Biestro committed 1147699 (1 file)
        Reviews: none

        JEXL-115:
        * Updated changes.xml

        Sebb made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Henri Biestro
            Reporter:
            Henri Biestro
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development