sentry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s..@apache.org
Subject [20/25] incubator-sentry git commit: SENTRY-913: Thread safe improvement for sqoop binding singleton (Dapeng Sun, reviewed by Guoquan Shen)
Date Thu, 05 Nov 2015 01:44:48 GMT
SENTRY-913: Thread safe improvement for sqoop binding singleton (Dapeng Sun, reviewed by Guoquan
Shen)


Project: http://git-wip-us.apache.org/repos/asf/incubator-sentry/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-sentry/commit/60e9b541
Tree: http://git-wip-us.apache.org/repos/asf/incubator-sentry/tree/60e9b541
Diff: http://git-wip-us.apache.org/repos/asf/incubator-sentry/diff/60e9b541

Branch: refs/heads/hive_plugin_v2
Commit: 60e9b541a6024e9fac6beadd7c771f69b2ba129f
Parents: c69350b
Author: Sun Dapeng <sdp@apache.org>
Authored: Wed Oct 14 15:59:59 2015 +0800
Committer: Sun Dapeng <sdp@apache.org>
Committed: Mon Nov 2 16:37:12 2015 +0800

----------------------------------------------------------------------
 .../sentry/sqoop/binding/SqoopAuthBindingSingleton.java     | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/60e9b541/sentry-binding/sentry-binding-sqoop/src/main/java/org/apache/sentry/sqoop/binding/SqoopAuthBindingSingleton.java
----------------------------------------------------------------------
diff --git a/sentry-binding/sentry-binding-sqoop/src/main/java/org/apache/sentry/sqoop/binding/SqoopAuthBindingSingleton.java
b/sentry-binding/sentry-binding-sqoop/src/main/java/org/apache/sentry/sqoop/binding/SqoopAuthBindingSingleton.java
index bdd60a4..7dd2a28 100644
--- a/sentry-binding/sentry-binding-sqoop/src/main/java/org/apache/sentry/sqoop/binding/SqoopAuthBindingSingleton.java
+++ b/sentry-binding/sentry-binding-sqoop/src/main/java/org/apache/sentry/sqoop/binding/SqoopAuthBindingSingleton.java
@@ -83,10 +83,13 @@ public class SqoopAuthBindingSingleton {
   }
 
   public static SqoopAuthBindingSingleton getInstance() {
-    if (instance != null) {
-      return instance;
+    if (instance == null) {
+      synchronized (SqoopAuthBindingSingleton.class) {
+        if (instance == null) {
+          instance = new SqoopAuthBindingSingleton();
+        }
+      }
     }
-    instance = new SqoopAuthBindingSingleton();
     return instance;
   }
 


Mime
View raw message