commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <>
Subject Re: [JEXL] New non-private mutable fields
Date Thu, 01 Dec 2011 15:10:25 GMT
On 1 December 2011 14:15, henrib <> wrote:

(BTW, please quote some context  (as I do here) when replying.
Otherwise it becomes rather difficult to follow the thread.)

> I don't think the JexlEngine mutable fields should be made volatile. Same as
> JexlArithmetic btw.
> The intent is not to change them but just to allow configuration of the
> behavior after the ctor but before usage.

Where the engine is used with multiple threads that only works if the
threads are started after all the set methods have been invoked.

Without volatile, if the engine has already been shared with multiple
threads, there is no knowing when, if ever, the threads will see the
written values.

Given that we cannot currently prevent this, adding volatile at least
guarantees consistent visibility.

Does that satisfy you?

> In the future, those should also
> be made final and/or use "feature" ala JexlThreadeArithmetic.
> This would probably require a JexlEngineBuilder of some sort since the list
> of options/parameters is pretty long...

Yes, but that would be for 3.0 or later.

> I'd rather see these setters documented the same (previous) way as in:
> This method is <em>not</em> thread safe; it should be called as an optional
> step of the JexlEngine initialization code before expression creation &amp;
> evaluation.
> And may be add:
> Changing them after initialization may result in undefined behavior.

Although that is not strictly necessary if using volatile, the
original wording is better in that it discourages later setting.
I'll update accordingly.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message