in src/main/java/org/apache/sling/scripting/core/impl/bundled/Script.java [97:125]
public void eval(@NotNull ScriptEngine scriptEngine, @NotNull ScriptContext context) throws ScriptException {
try {
if (scriptEngine instanceof Compilable
&& (compiledScript == null
|| !scriptEngine
.getFactory()
.equals(compiledScript.getEngine().getFactory()))) {
compilationLock.lock();
try {
if (compiledScript == null
|| !scriptEngine
.getFactory()
.equals(compiledScript.getEngine().getFactory())) {
compiledScript = ((Compilable) scriptEngine)
.compile(new ScriptNameAwareReader(new StringReader(getSourceCode()), getName()));
}
} finally {
compilationLock.unlock();
}
}
if (compiledScript != null) {
compiledScript.eval(context);
} else {
scriptEngine.eval(getSourceCode(), context);
}
} catch (IOException e) {
throw new ScriptException(e);
}
}