From 07cf7c221a9d190ea08a7ae53ea3cfea4d9e8a37 Mon Sep 17 00:00:00 2001 From: tomas-sexenian Date: Tue, 3 Oct 2023 11:30:20 -0300 Subject: [PATCH] Fixed Code Correctness: Double-Checked Locking in various constructors Issue: 105113 --- common/src/main/java/com/genexus/ApplicationContext.java | 2 +- common/src/main/java/com/genexus/BaseProvider.java | 4 ++-- .../src/main/java/com/genexus/diagnostics/GXDebugManager.java | 4 ++-- common/src/main/java/com/genexus/util/PropertiesManager.java | 2 +- .../com/genexus/internet/websocket/GXWebSocketService.java | 2 +- java/src/main/java/com/genexus/platform/NativeFunctions.java | 2 +- java/src/main/java/com/genexus/webpanels/BlobsCleaner.java | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/common/src/main/java/com/genexus/ApplicationContext.java b/common/src/main/java/com/genexus/ApplicationContext.java index 59717b83a..a7af446c4 100644 --- a/common/src/main/java/com/genexus/ApplicationContext.java +++ b/common/src/main/java/com/genexus/ApplicationContext.java @@ -7,7 +7,7 @@ public class ApplicationContext { - private static ApplicationContext instance; + private volatile static ApplicationContext instance; private String currentLocation = ""; diff --git a/common/src/main/java/com/genexus/BaseProvider.java b/common/src/main/java/com/genexus/BaseProvider.java index d3730906b..ea0a06257 100644 --- a/common/src/main/java/com/genexus/BaseProvider.java +++ b/common/src/main/java/com/genexus/BaseProvider.java @@ -27,9 +27,9 @@ public abstract class BaseProvider implements IGXSmartCacheProvider { private static final ILogger logger = LogManager.getLogger(BaseProvider.class); - ConcurrentHashMap> queryTables; + volatile ConcurrentHashMap> queryTables; protected Date startupDate; - Object syncLock = new Object(); + static Object syncLock = new Object(); protected static final String FORCED_INVALIDATE = "SD"; diff --git a/common/src/main/java/com/genexus/diagnostics/GXDebugManager.java b/common/src/main/java/com/genexus/diagnostics/GXDebugManager.java index 2dd22ab4e..9dfd0a6b8 100644 --- a/common/src/main/java/com/genexus/diagnostics/GXDebugManager.java +++ b/common/src/main/java/com/genexus/diagnostics/GXDebugManager.java @@ -18,9 +18,9 @@ public class GXDebugManager static final int PGM_INFO_NO_PARENT = 0; private static final long MICRO_FREQ = 1000; - private static GXDebugManager instance; + private volatile static GXDebugManager instance; private static final Object sessionLock = new Object(); - private static boolean initialized = false; + private volatile static boolean initialized = false; public static GXDebugManager getInstance() { if(!initialized) diff --git a/common/src/main/java/com/genexus/util/PropertiesManager.java b/common/src/main/java/com/genexus/util/PropertiesManager.java index 1a442519e..d76d8d595 100644 --- a/common/src/main/java/com/genexus/util/PropertiesManager.java +++ b/common/src/main/java/com/genexus/util/PropertiesManager.java @@ -11,7 +11,7 @@ public final class PropertiesManager { - private static PropertiesManager instance; + private volatile static PropertiesManager instance; private Hashtable propertyFiles; diff --git a/java/src/main/java/com/genexus/internet/websocket/GXWebSocketService.java b/java/src/main/java/com/genexus/internet/websocket/GXWebSocketService.java index 8857d8789..b16c46a44 100644 --- a/java/src/main/java/com/genexus/internet/websocket/GXWebSocketService.java +++ b/java/src/main/java/com/genexus/internet/websocket/GXWebSocketService.java @@ -23,7 +23,7 @@ public class GXWebSocketService { public static final ILogger logger = LogManager.getLogger(GXWebSocketService.class); - private static GXWebSocketService instance; + private volatile static GXWebSocketService instance; private String[] handlerCache = new String[HandlerType.values().length]; private GXWebSocketSessionCollection wsClients = new GXWebSocketSessionCollection(); diff --git a/java/src/main/java/com/genexus/platform/NativeFunctions.java b/java/src/main/java/com/genexus/platform/NativeFunctions.java index 164e3f62e..8ff0c2e40 100644 --- a/java/src/main/java/com/genexus/platform/NativeFunctions.java +++ b/java/src/main/java/com/genexus/platform/NativeFunctions.java @@ -4,7 +4,7 @@ public class NativeFunctions { - private static INativeFunctions instance; + private volatile static INativeFunctions instance; private static Boolean isMicrosoft; diff --git a/java/src/main/java/com/genexus/webpanels/BlobsCleaner.java b/java/src/main/java/com/genexus/webpanels/BlobsCleaner.java index 2d904b61a..8951954af 100644 --- a/java/src/main/java/com/genexus/webpanels/BlobsCleaner.java +++ b/java/src/main/java/com/genexus/webpanels/BlobsCleaner.java @@ -10,7 +10,7 @@ public class BlobsCleaner { - private static BlobsCleaner instance = null; + private volatile static BlobsCleaner instance = null; //Blobs archived by websession id private Hashtable> blobsTable;