commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dmitri Blinov (JIRA)" <>
Subject [jira] [Commented] (JEXL-193) InterruptedException is swallowed in function call in silent and non-strict mode
Date Fri, 06 May 2016 15:59:12 GMT


Dmitri Blinov commented on JEXL-193:

Suppose we have a multi-threaded system where each request is processed by some thread from
the pool, and we have a policy for each request not to take longer when specified amount of
time, and for requests that are not able to complete within the specified period we want those
requests to be interrupted. That may be implemented by invoking Thread.interrupt() which by
design should cancel all outstanding processing. If by chance the request is using jexl scripting
when thread was interrupted, I expect jexl not only to break current script execution but
somehow to notify me that the script processing has been ended unexpectedly, so I could decide
how this should be handled, possibly rolling back pending transaction etc. As I see now from
the code that exception is only thrown by in non-silent mode. If I chose to use non-silent
mode to suit some other purposes, I'll never know that the thread was interrupted.

> InterruptedException is swallowed in function call in silent and non-strict mode
> --------------------------------------------------------------------------------
>                 Key: JEXL-193
>                 URL:
>             Project: Commons JEXL
>          Issue Type: Bug
>    Affects Versions: 3.0
>            Reporter: Dmitri Blinov
>            Assignee: Henri Biestro
>             Fix For: 3.0.1
> The following test case fails with 
> {code}
> java.lang.AssertionError: Values should be different. Actual: 42
> 	at
> 	at org.junit.Assert.failEquals(
> 	at org.junit.Assert.assertNotEquals(
> {code}
> {code}
>     public static class TestContext extends MapContext implements JexlContext.NamespaceResolver
>         public int interrupt() throws InterruptedException {
>             throw new InterruptedException();
>         }
>     }
>     @Test
>     public void testInterrupt() throws Exception {
>         JexlEngine jexl = new JexlBuilder().arithmetic(new JexlArithmetic(false)).strict(false).silent(true).create();
>         JexlScript e = jexl.createScript("interrupt(); return 42");
>         Callable<Object> c = e.callable(new TestContext());
>         Object t =;
>         Assert.assertNotEquals(42, t);
>     }
> {code}
> Expected behaviour is to cancel script execution

This message was sent by Atlassian JIRA

View raw message