maytasm opened a new pull request, #14795:
URL: https://github.com/apache/druid/pull/14795

   Fix Javascript tiered broker selector strategy and Javascript filter for 
Java 17
   
   ### Description
   Javascript tiered broker selector strategy and Javascript filter broke when 
running Druid on Java 17.
   Javascript tiered broker selector strategy and Javascript filter depend on 
Nashorn JavaScript Engine (`final ScriptEngine engine = new 
ScriptEngineManager().getEngineByName("javascript");`). The Nashorn JavaScript 
Engine has been removed from Java. [Deprecated in Java 
11](https://openjdk.org/jeps/335), [removed in Java 
15](https://openjdk.org/jeps/372). 
(https://stackoverflow.com/questions/71481562/use-javascript-scripting-engine-in-java-17)
   
   Some options I found:
   - We can use different script engine, as 
[GraalVM](https://en.wikipedia.org/wiki/GraalVM). 
(https://stackoverflow.com/a/71481633/4942837)
   - We can add back the Nashorn JavaScript Engine as a dependency and continue 
to use it (https://github.com/openjdk/nashorn) See: 
https://github.com/szegedi/nashorn/wiki/Using-Nashorn-with-different-Java-versions
   
   I chose the second option which is to add back the Nashorn JavaScript Engine 
as a dependency and continue to use it. Since Nashorn was the deprecated 
javascript engine that used to come with Java 8, I think it should be 
same/similar to what we had before (compare to using a new script engine like 
GraalVM). However, 
https://github.com/szegedi/nashorn/wiki/Using-Nashorn-with-different-Java-versions
 suggest that the standalone is not compatible with Java 8-10 and is only 
compatible with Java 11 and later 
   
   This PR has:
   
   - [x] been self-reviewed.
      - [ ] using the [concurrency 
checklist](https://github.com/apache/druid/blob/master/dev/code-review/concurrency.md)
 (Remove this item if the PR doesn't have any relation to concurrency.)
   - [ ] added documentation for new or modified features or behaviors.
   - [ ] a release note entry in the PR description.
   - [ ] added Javadocs for most classes and all non-trivial methods. Linked 
related entities via Javadoc links.
   - [ ] added or updated version, license, or notice information in 
[licenses.yaml](https://github.com/apache/druid/blob/master/dev/license.md)
   - [ ] added comments explaining the "why" and the intent of the code 
wherever would not be obvious for an unfamiliar reader.
   - [ ] added unit tests or modified existing tests to cover new code paths, 
ensuring the threshold for [code 
coverage](https://github.com/apache/druid/blob/master/dev/code-review/code-coverage.md)
 is met.
   - [ ] added integration tests.
   - [x] been tested in a test Druid cluster.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to