I am interested in the lifecycle and concurrency semantics of (Rhino) Script Engine and associated classes. Specifically:
- Is
Bindingssupposed to be thread safe? - Should multiple threads be allowed to share a single ScriptEngine instance?
- ... or should each thread construct a short-lived instance?
- ... or keep them in a pool?
- What happens if multiple threads concurrently call
ScriptEngine.eval(...)? - Same questions for
CompiledScriptinstances - Same questions for interface implementations generated using
Invocable.getInterface(...)? - Presumably, objects placed in Bindings follow Java's garbage collection. What about garbage collection of objects that don't end up in the bindings?