浏览代码

HDFS-7107. Avoid Findbugs warning for synchronization on AbstractNNFailoverProxyProvider#fallbackToSimpleAuth. Contributed by Chris Nauroth.

cnauroth 10 年之前
父节点
当前提交
47491f9a11

+ 3 - 0
hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt

@@ -905,6 +905,9 @@ Release 2.6.0 - UNRELEASED
     HDFS-7105. Allow falling back to a non-SASL connection on
     DataTransferProtocol in several edge cases. (cnauroth)
 
+    HDFS-7107. Avoid Findbugs warning for synchronization on
+    AbstractNNFailoverProxyProvider#fallbackToSimpleAuth. (cnauroth)
+
 Release 2.5.1 - 2014-09-05
 
   INCOMPATIBLE CHANGES

+ 4 - 2
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/AbstractNNFailoverProxyProvider.java

@@ -38,12 +38,14 @@ public abstract class AbstractNNFailoverProxyProvider<T> implements
   public abstract boolean useLogicalURI(); 
 
   /**
-   * Set for tracking if a secure client falls back to simple auth.
+   * Set for tracking if a secure client falls back to simple auth.  This method
+   * is synchronized only to stifle a Findbugs warning.
    *
    * @param fallbackToSimpleAuth - set to true or false during this method to
    *   indicate if a secure client falls back to simple auth
    */
-  public void setFallbackToSimpleAuth(AtomicBoolean fallbackToSimpleAuth) {
+  public synchronized void setFallbackToSimpleAuth(
+      AtomicBoolean fallbackToSimpleAuth) {
     this.fallbackToSimpleAuth = fallbackToSimpleAuth;
   }
 }