tamaya-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pottlin...@apache.org
Subject [incubator-tamaya-sandbox] branch master updated: TAMAYA-277: Fix warning by making method synchronized instead of double lock-check
Date Sat, 11 May 2019 22:10:10 GMT
This is an automated email from the ASF dual-hosted git repository.

pottlinger pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-tamaya-sandbox.git


The following commit(s) were added to refs/heads/master by this push:
     new 8b892c7  TAMAYA-277: Fix warning by making method synchronized instead of double
lock-check
8b892c7 is described below

commit 8b892c7466835a923ca07c40d2e2ae49b8dcfd54
Author: Hugo Hirsch <github@hugo-hirsch.de>
AuthorDate: Sun May 12 00:10:02 2019 +0200

    TAMAYA-277: Fix warning by making method synchronized instead of double lock-check
---
 .../apache/tamaya/sysprops/ConfiguredSystemProperties.java    | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/configured-sysprops/src/main/java/org/apache/tamaya/sysprops/ConfiguredSystemProperties.java
b/configured-sysprops/src/main/java/org/apache/tamaya/sysprops/ConfiguredSystemProperties.java
index bc1088d..fdd0609 100644
--- a/configured-sysprops/src/main/java/org/apache/tamaya/sysprops/ConfiguredSystemProperties.java
+++ b/configured-sysprops/src/main/java/org/apache/tamaya/sysprops/ConfiguredSystemProperties.java
@@ -47,9 +47,6 @@ public class ConfiguredSystemProperties extends Properties {
     private Properties initialProperties;
     private static Properties contextualProperties;
 
-    private final Object LOCK = new Object();
-
-
     private ConfiguredSystemProperties(Properties initialProperties) {
         super(initialProperties);
         this.initialProperties = initialProperties;
@@ -316,13 +313,9 @@ public class ConfiguredSystemProperties extends Properties {
         contextualProperties.clear();
     }
 
-    protected Properties getContextualProperties() {
+    protected synchronized Properties getContextualProperties() {
         if (contextualProperties == null) {
-            synchronized (LOCK) {
-                if (contextualProperties == null) {
-                    contextualProperties = createNewProperties();
-                }
-            }
+            contextualProperties = createNewProperties();
         }
         return contextualProperties;
     }


Mime
View raw message