8u20 with multi-threaded class cache

Chris Pettitt cpettitt at linkedin.com
Mon Mar 16 22:03:02 UTC 2015

Hi folks,

We're looking into the possibility of using the class cache in multi-threaded code, as introduced in [1]. We have a few questions related to this feature:

1. The article implies that ScriptEngine can be treated as thread-safe - provided we're not using the default context - though the code doesn't state this explicitly. Is this a safe assumption? Are there any other caveats?

2. As we need to set the Context for each eval, does this lock us out of using Invocable?

3. The code for determining if two Sources are the same ultimately falls back to a comparison of the url / name / content of the scripts. Is there a way to eval with a Source to avoid this fallback? It looks like it is not exposed in a public way.

[1]: https://blogs.oracle.com/nashorn/entry/improving_nashorn_startup_time_using


More information about the nashorn-dev mailing list