commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebb (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (JEXL-83) Make JexlArithmetic immutable (and threadsafe)
Date Thu, 01 Dec 2011 09:01:41 GMT

    [ https://issues.apache.org/jira/browse/JEXL-83?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13160757#comment-13160757
] 

Sebb commented on JEXL-83:
--------------------------

An alternative solution is to make the boolean variables (strict/debug/silent) volatile.

If one thread changes the value, then at least all other threads would see the updated value
(which is currently not the case).

As far as I can tell the code does not rely on the values remaining unchanged; it checks the
values on demand.

So the worst that could happen would be minor changes in behaviour during an evaluation.
                
> Make JexlArithmetic immutable (and threadsafe)
> ----------------------------------------------
>
>                 Key: JEXL-83
>                 URL: https://issues.apache.org/jira/browse/JEXL-83
>             Project: Commons JEXL
>          Issue Type: Improvement
>            Reporter: Sebb
>            Assignee: Henri Biestro
>             Fix For: 3.0
>
>         Attachments: JEXL-83.patch
>
>
> The JexlArithmetic class is currently not thread-safe because of the single field:
>     /** Whether this JexlArithmetic instance behaves in strict or lenient mode. */
>     protected boolean strict;
> If this field were made final, and the setLenient() method removed, then the class would
be immutable and therefore thread-safe.
> This would mean that JexlEngine would also have to change.
> The class is new to 2.0, so this is the best time to fix this.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message