class GraalJavaScriptExecutor extends ScriptExecutor {

	private final Map<String, Source> scriptMap = new CopyOnWriteHashMap<>();

	private Engine engine;

	@Override
	public ScriptExecutor init() {
		engine = Engine.create();
		return this;
	}

	@Override
	public void load(String nodeId, String script) {
		try {
			scriptMap.put(nodeId, Source.create("js", (CharSequence) compile(script)));
		}
		catch (Exception e) {
			String errorMsg = StrUtil.format("script loading error for node[{}], error msg:{}", nodeId, e.getMessage());
			throw new ScriptLoadException(errorMsg);
		}
	}

	@Override
	public void unLoad(String nodeId) {
		scriptMap.remove(nodeId);
	}

	@Override
	public List<String> getNodeIds() {
		return new ArrayList<>(scriptMap.keySet());
	}

	@Override
	public Object executeScript(ScriptExecuteWrap wrap) {<FILL_FUNCTION_BODY>}

	@Override
	public void cleanCache() {
		scriptMap.clear();
	}

	@Override
	public ScriptTypeEnum scriptType() {
		return ScriptTypeEnum.JS;
	}

	@Override
	public Object compile(String script) throws Exception {
		String wrapScript = StrUtil.format("function process(){{}} process();", script);
		Context context = Context.newBuilder().allowAllAccess(true).engine(engine).build();
		context.parse(Source.create("js", wrapScript));
		return wrapScript;
	}

}

		if (!scriptMap.containsKey(wrap.getNodeId())) {
			String errorMsg = StrUtil.format("script for node[{}] is not loaded", wrap.getNodeId());
			throw new ScriptLoadException(errorMsg);
		}
		try (Context context = Context.newBuilder().allowAllAccess(true).engine(this.engine).build()) {
			Value bindings = context.getBindings("js");

			bindParam(wrap, bindings::putMember, (s, o) -> {
				if (!bindings.hasMember(s)) {
					bindings.putMember(s, o);
				}
			});

			Value value = context.eval(scriptMap.get(wrap.getNodeId()));
			if (value.isBoolean()) {
				return value.asBoolean();
			}
			else if (value.isNumber()) {
				return value.asInt();
			}
			else if (value.isString()) {
				return value.asString();
			}
			return value;
		}
		catch (Exception e) {
			throw e;
		}
	
<methods>public non-sealed void <init>() ,public void bindParam(com.yomahub.liteflow.script.ScriptExecuteWrap, BiConsumer<java.lang.String,java.lang.Object>, BiConsumer<java.lang.String,java.lang.Object>) ,public abstract void cleanCache() ,public abstract java.lang.Object compile(java.lang.String) throws java.lang.Exception,public java.lang.Object execute(com.yomahub.liteflow.script.ScriptExecuteWrap) throws java.lang.Exception,public abstract java.lang.Object executeScript(com.yomahub.liteflow.script.ScriptExecuteWrap) throws java.lang.Exception,public abstract List<java.lang.String> getNodeIds() ,public com.yomahub.liteflow.script.ScriptExecutor init() ,public abstract void load(java.lang.String, java.lang.String) ,public abstract com.yomahub.liteflow.enums.ScriptTypeEnum scriptType() ,public abstract void unLoad(java.lang.String) <variables>