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;
  }
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.

@param language the language (such as 'groovy' for the script engine)
@return the cached engine or null if no script engine can be created for the given language