From b1a3dfa15089e8d329098d987b1efaa980187118 Mon Sep 17 00:00:00 2001 From: kamaci Date: Sat, 24 Nov 2018 22:57:47 +0300 Subject: [PATCH] Double-checked locking bug is fixed. --- .../stanbol/commons/testing/jarexec/JarExecutor.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/commons/testing/jarexec/src/main/java/org/apache/stanbol/commons/testing/jarexec/JarExecutor.java b/commons/testing/jarexec/src/main/java/org/apache/stanbol/commons/testing/jarexec/JarExecutor.java index 03c2a884b..0a96d1ce4 100644 --- a/commons/testing/jarexec/src/main/java/org/apache/stanbol/commons/testing/jarexec/JarExecutor.java +++ b/commons/testing/jarexec/src/main/java/org/apache/stanbol/commons/testing/jarexec/JarExecutor.java @@ -72,13 +72,9 @@ public int getServerPort() { return serverPort; } - public static JarExecutor getInstance(Properties config) throws ExecutorException { + public synchronized static JarExecutor getInstance(Properties config) throws ExecutorException { if (instance == null) { - synchronized (JarExecutor.class) { - if (instance == null) { - instance = new JarExecutor(config); - } - } + instance = new JarExecutor(config); } return instance; }