Uploaded image for project: 'Commons JEXL'
  1. Commons JEXL
  2. JEXL-255

Ability to continue interrupted scripts

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.1
    • 3.2
    • None

    Description

      I'm trying to implement the @timeout annotation that should work like the following

      @timeout(15000) { return longrunningcall(); }
       

      The idea is to protect part of the script code from being executed indefinitely or more than allowed by business rules. The script should continue its evaluation after the @timeout annotation regardless of whether the timeout has taken place or not.

      There is a straightforward implementation that starts guarding thread which should invoke Thread.interrupt() for the thread executing the script. The InterruptedException | JexlException.Cancel is then caught and swallowed inside the processAnnotation() method, and if the guard thread has fired, which means the timeout occured, the null value is returned.

      I expected the script to continue its evaluation after the exception is processed inside processAnnotation() code, but the script nevertheless throwed JexlException.Cancel as a result. The suggestion is to allow script to continue its evaluation once InterruptedException or JexlException.Cancel is processed.

      Attachments

        Activity

          People

            henrib Henri Biestro
            dmitri_blinov Dmitri Blinov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: