Java Script Engine getScriptEngine()

Here you can find the source of getScriptEngine()

Description

get Script Engine

License

Open Source License

Declaration

private static ScriptEngine getScriptEngine() 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.HashMap;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;

public class Main {
    private static HashMap<Long, ScriptEngine> context = new HashMap<Long, ScriptEngine>();

    private static ScriptEngine getScriptEngine() {
        long id = Thread.currentThread().getId();
        ScriptEngine engine = context.get(id);
        if (engine == null) {
            ScriptEngineManager engineManager = new ScriptEngineManager();
            engine = engineManager.getEngineByName("nashorn");
            context.put(id, engine);/*from  www. jav a  2s.co  m*/
        }
        return engine;
    }
}

Related

  1. getAppleScriptEngine()
  2. getAvailableEngineGroups()
  3. getDefaultScriptEngineManager()
  4. getEngine()
  5. getEngine(String engineName)
  6. getScriptEngine(final ClassLoader loader, final String... args)
  7. getScriptEngineManager()
  8. getStringOrExcept(ScriptEngine e, String vname)
  9. getVersionString(ScriptEngineFactory factory)