leventov commented on a change in pull request #6662: Double-checked locking
bug is fixed.
URL: https://github.com/apache/incubator-druid/pull/6662#discussion_r236307413
##########
File path:
processing/src/main/java/org/apache/druid/query/aggregation/JavaScriptAggregatorFactory.java
##########
@@ -283,18 +283,14 @@ public String toString()
* This class can be used by multiple threads, so this function should be
thread-safe to avoid extra
* script compilation.
*/
- private void checkAndCompileScript()
+ private synchronized void checkAndCompileScript()
Review comment:
This class also requires changes, similar to points 2. and 3.
`LazyFileSessionCredentialsProvider`.
For p. 2, please add a comment that the returned compiled script object is
an anonymous inner class, therefore it has an implicit final field (a reference
to the object of the enclosing class), therefore it is safely initialized
without `volatile` on `compiledScript`.
For p. 3, `checkAndCompileScript()` should be made to return the
compiledScript object and that object must be used when
`checkAndCompileScript()` is called, instead of re-reading `compiledScript`.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]