scriptEnginePools.put(engineId, new ScriptEnginePool(engineId));
}
}
ScriptEnginePool scriptEnginePool = scriptEnginePools.get(engineId);
SoapUIScriptEngine scriptEngine = scriptEnginePool.getScriptEngine();
try {
scriptEngine.setScript(name);
for (Map.Entry<String, Object> entry : objects.entrySet()) {
scriptEngine.setVariable(entry.getKey(), entry.getValue());
}
Object result = scriptEngine.run();
return result == null ? null : result.toString();
} catch (Throwable e) {
log.error("Error evaluating script", e);
return e.getMessage();
} finally {
scriptEngine.clearVariables();
scriptEnginePool.returnScriptEngine(scriptEngine);
}
}