kylin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From liy...@apache.org
Subject kylin git commit: KYLIN-1493 make ExecutableManager.getInstance thread safe
Date Tue, 15 Mar 2016 10:20:38 GMT
Repository: kylin
Updated Branches:
  refs/heads/master 697c83778 -> dc30d79c5


KYLIN-1493 make ExecutableManager.getInstance thread safe

Signed-off-by: Li Yang <liyang@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/dc30d79c
Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/dc30d79c
Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/dc30d79c

Branch: refs/heads/master
Commit: dc30d79c5aa48400bfcfc2f5e94990d567821f9d
Parents: 697c837
Author: John Zhao <yunjzhao@ebay.com>
Authored: Mon Mar 14 16:36:12 2016 -0700
Committer: Li Yang <liyang@apache.org>
Committed: Tue Mar 15 18:20:29 2016 +0800

----------------------------------------------------------------------
 .../org/apache/kylin/job/manager/ExecutableManager.java  | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/dc30d79c/core-job/src/main/java/org/apache/kylin/job/manager/ExecutableManager.java
----------------------------------------------------------------------
diff --git a/core-job/src/main/java/org/apache/kylin/job/manager/ExecutableManager.java b/core-job/src/main/java/org/apache/kylin/job/manager/ExecutableManager.java
index 3effbe7..45e0521 100644
--- a/core-job/src/main/java/org/apache/kylin/job/manager/ExecutableManager.java
+++ b/core-job/src/main/java/org/apache/kylin/job/manager/ExecutableManager.java
@@ -58,12 +58,13 @@ public class ExecutableManager {
     public static ExecutableManager getInstance(KylinConfig config) {
         ExecutableManager r = CACHE.get(config);
         if (r == null) {
-            r = new ExecutableManager(config);
-            CACHE.put(config, r);
-            if (CACHE.size() > 1) {
-                logger.warn("More than one singleton exist");
+            synchronized (ExecutableManager.class) {
+                r = CACHE.get(config);
+                if (r == null) {
+                    r = new ExecutableManager(config);
+                    CACHE.put(config, r);
+                }
             }
-
         }
         return r;
     }


Mime
View raw message