diff options
author | Noel Grandin <noel@peralex.com> | 2014-08-13 09:02:41 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-08-20 10:35:51 +0200 |
commit | 252ed1708ad5a007e4c47c243595206650876a2b (patch) | |
tree | b2a7a47f8a39c598c25355640a77022918c2d209 /scripting/workben | |
parent | a240a78cc771a89febfe181abe78d2cf16e1970f (diff) |
double-checked locking is not thread-safe in Java
found by PMD
Change-Id: Ibd4a9139c626932bec56c0b1dd32b4d59c8440b1
Diffstat (limited to 'scripting/workben')
-rw-r--r-- | scripting/workben/ifc/scripting/ScriptingUtils.java | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/scripting/workben/ifc/scripting/ScriptingUtils.java b/scripting/workben/ifc/scripting/ScriptingUtils.java index ce6071c78dd2..eb317036e2ab 100644 --- a/scripting/workben/ifc/scripting/ScriptingUtils.java +++ b/scripting/workben/ifc/scripting/ScriptingUtils.java @@ -34,13 +34,9 @@ public class ScriptingUtils { private ScriptingUtils() { } - public static ScriptingUtils getDefault() { - if (utils == null) { - synchronized (ScriptingUtils.class) { - if (utils == null) - utils = new ScriptingUtils(); - } - } + public static synchronized ScriptingUtils getDefault() { + if (utils == null) + utils = new ScriptingUtils(); return utils; } |