public ScriptEngine getScriptEngine ( String language , boolean resolveFromCache ) { ScriptEngine scriptEngine = null ; if ( resolveFromCache ) { scriptEngine = cachedEngines . get ( language ) ; if ( scriptEngine == null ) { scriptEngine = scriptEngineManager . getEngineByName ( language ) ; if ( scriptEngine != null ) { if ( ScriptingEngines . GROOVY_SCRIPTING_LANGUAGE . equals ( language ) ) { configureGroovyScriptEngine ( scriptEngine ) ; } if ( isCachable ( scriptEngine ) ) { cachedEngines . put ( language , scriptEngine ) ; } } } } else { scriptEngine = scriptEngineManager . getEngineByName ( language ) ; } return scriptEngine ; }
Returns a cached script engine or creates a new script engine if no such engine is currently cached .