summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris André <chris.andre@yoppworks.com>2020-04-15 20:18:59 -0400
committerOfir Sonsino <ofir.sonsino@intl.att.com>2020-04-19 08:33:50 +0000
commit1491bd0d20906819481c8d334e5d4d1639fadb8c (patch)
tree81f1af401f9514fdcbb52438d2cdb15ab12634f4
parentc36523ba9887990b8a785266fd5d688e4888d67d (diff)
Simplified thread-safety for the `getGson` method
Issue-ID: SDC-2900 Signed-off-by: Chris Andre <chris.andre@yoppworks.com> Change-Id: I8c687bb408a5e0b1e95316bdae6d53126bc82696
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/util/GsonFactory.java6
1 files changed, 1 insertions, 5 deletions
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/util/GsonFactory.java b/common-app-api/src/main/java/org/openecomp/sdc/common/util/GsonFactory.java
index 7c3bcb6cad..882422ba4a 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/util/GsonFactory.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/util/GsonFactory.java
@@ -26,13 +26,9 @@ import com.google.gson.GsonBuilder;
public class GsonFactory {
private static Gson gson = null;
- public static Gson getGson() {
+ public static synchronized Gson getGson() {
if (gson == null) {
- synchronized (GsonFactory.class) {
- if (gson == null) {
gson = new GsonBuilder().disableHtmlEscaping().serializeNulls().create();
- }
- }
}
return gson;