From 0d297aada9850e6eceb418e07d5d1610817f0bef Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Wed, 24 Mar 2021 10:30:11 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=89=B9=E9=87=8F=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E7=94=A8=E4=BE=8B=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/metersphere/commons/utils/ScriptEngineUtils.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/src/main/java/io/metersphere/commons/utils/ScriptEngineUtils.java b/backend/src/main/java/io/metersphere/commons/utils/ScriptEngineUtils.java index 599d1b5234..2e2431d32d 100644 --- a/backend/src/main/java/io/metersphere/commons/utils/ScriptEngineUtils.java +++ b/backend/src/main/java/io/metersphere/commons/utils/ScriptEngineUtils.java @@ -22,7 +22,8 @@ public class ScriptEngineUtils { } } - public static String calculate(String input) { + // graal.js 禁止多线程同时访问,加上 synchronized + public synchronized static String calculate(String input) { try { return engine.eval("calculate('" + input + "')").toString(); } catch (ScriptException e) {