Author: cnauroth
Date: Sat Mar  5 00:04:52 2016
New Revision: 1733680

URL: http://svn.apache.org/viewvc?rev=1733680&view=rev
Log:
ZOOKEEPER-2379: recent commit broke findbugs qabot check (rakeshr via cnauroth)

Modified:
    zookeeper/branches/branch-3.5/CHANGES.txt
    
zookeeper/branches/branch-3.5/src/java/main/org/apache/zookeeper/client/ZooKeeperSaslClient.java

Modified: zookeeper/branches/branch-3.5/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/zookeeper/branches/branch-3.5/CHANGES.txt?rev=1733680&r1=1733679&r2=1733680&view=diff
==============================================================================
--- zookeeper/branches/branch-3.5/CHANGES.txt (original)
+++ zookeeper/branches/branch-3.5/CHANGES.txt Sat Mar  5 00:04:52 2016
@@ -105,6 +105,9 @@ BUGFIXES:
   ZOOKEEPER-2375: Prevent multiple initialization of login object in each
   ZooKeeperSaslClient instance (yuemeng via rakeshr)
 
+  ZOOKEEPER-2379: recent commit broke findbugs qabot check
+  (rakeshr via cnauroth)
+
 IMPROVEMENTS:
 
   ZOOKEEPER-2270: Allow MBeanRegistry to be overridden for better unit tests

Modified: 
zookeeper/branches/branch-3.5/src/java/main/org/apache/zookeeper/client/ZooKeeperSaslClient.java
URL: 
http://svn.apache.org/viewvc/zookeeper/branches/branch-3.5/src/java/main/org/apache/zookeeper/client/ZooKeeperSaslClient.java?rev=1733680&r1=1733679&r2=1733680&view=diff
==============================================================================
--- 
zookeeper/branches/branch-3.5/src/java/main/org/apache/zookeeper/client/ZooKeeperSaslClient.java
 (original)
+++ 
zookeeper/branches/branch-3.5/src/java/main/org/apache/zookeeper/client/ZooKeeperSaslClient.java
 Sat Mar  5 00:04:52 2016
@@ -64,6 +64,7 @@ public class ZooKeeperSaslClient {
     public static final String LOGIN_CONTEXT_NAME_KEY = 
"zookeeper.sasl.clientconfig";
     public static final String ENABLE_CLIENT_SASL_KEY = 
"zookeeper.sasl.client";
     public static final String ENABLE_CLIENT_SASL_DEFAULT = "true";
+    private static volatile boolean initializedLogin = false; 
 
     /**
      * Returns true if the SASL client is enabled. By default, the client
@@ -217,7 +218,7 @@ public class ZooKeeperSaslClient {
     private SaslClient createSaslClient(final String servicePrincipal,
                                                      final String 
loginContext) throws LoginException {
         try {
-            if (login == null) {
+            if (!initializedLogin) {
                 synchronized (ZooKeeperSaslClient.class) {
                     if (login == null) {
                         if (LOG.isDebugEnabled()) {
@@ -227,6 +228,7 @@ public class ZooKeeperSaslClient {
                         // in order to ensure the login is initialized only 
once, it must be synchronized the code snippet.
                         login = new Login(loginContext, new 
ClientCallbackHandler(null));
                         login.startThreadIfNeeded();
+                        initializedLogin = true;
                     }
                 }
             }


Reply via email to