You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sentry.apache.org by sd...@apache.org on 2015/10/15 03:41:34 UTC

incubator-sentry git commit: SENTRY-913: Thread safe improvement for sqoop binding singleton (Dapeng Sun, reviewed by Guoquan Shen)

Repository: incubator-sentry
Updated Branches:
  refs/heads/master 557c81834 -> 7fe082a65


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/7fe082a6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-sentry/tree/7fe082a6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-sentry/diff/7fe082a6

Branch: refs/heads/master
Commit: 7fe082a65c56a8d87ecc223998977e5004947eeb
Parents: 557c818
Author: Sun Dapeng <sd...@apache.org>
Authored: Wed Oct 14 15:59:59 2015 +0800
Committer: Sun Dapeng <sd...@apache.org>
Committed: Wed Oct 14 15:59:59 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/7fe082a6/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;
   }