commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Henri Biestro (JIRA)" <j...@apache.org>
Subject [jira] Commented: (JEXL-83) Make JexlArithmetic immutable (and threadsafe)
Date Fri, 14 Aug 2009 17:57:14 GMT

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

Henri Biestro commented on JEXL-83:
-----------------------------------


I guess the real question is whether there is any functional need to make this property mutable
in the first place - besides convenience & testing purpose. The same could be said for
"silent" & "debug" mode in the JexlEngine btw.

The other options are:
1/ document these methods as non-thread safe; ie, use these at initialization time or in a
single threaded environment.
2/ make these field volatile or synchronize their get/set, document their effects more &
tag them as convenience methods; we'd only gain thread safety but would avoid added code complexity.
3/ make these properties immutabe, get rid of the setters & modify the JexlEngine ctor;
since there are already 4 params in the ctor, a "builder" would seem in order.

My personal vote goes for option 1/.


> 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
>             Fix For: Later
>
>
> 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.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message