Ver código fonte

HADOOP-13179. GenericOptionsParser is not thread-safe because commons-cli OptionBuilder is not thread-safe. (Contributed by hongbin ma)

(cherry picked from commit 5cd19e429e7aef8751599dc5f54ffe29a9dc3ea9)
Vinayakumar B 9 anos atrás
pai
commit
06b76f1586

+ 1 - 1
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/GenericOptionsParser.java

@@ -208,7 +208,7 @@ public class GenericOptionsParser {
    * Specify properties of each generic option
    * Specify properties of each generic option
    */
    */
   @SuppressWarnings("static-access")
   @SuppressWarnings("static-access")
-  private static Options buildGeneralOptions(Options opts) {
+  private static synchronized Options buildGeneralOptions(Options opts) {
     Option fs = OptionBuilder.withArgName("local|namenode:port")
     Option fs = OptionBuilder.withArgName("local|namenode:port")
     .hasArg()
     .hasArg()
     .withDescription("specify a namenode")
     .withDescription("specify a namenode")