From 69aaf114670141b29119abe7ef46229fd19cc393 Mon Sep 17 00:00:00 2001 From: Daryn Sharp Date: Fri, 19 Jul 2013 13:39:50 +0000 Subject: [PATCH] merge -c 1504874 FIXES: HADOOP-9748. Reduce blocking on UGI.ensureInitialized (daryn) git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1504875 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-common-project/hadoop-common/CHANGES.txt | 2 ++ .../org/apache/hadoop/security/UserGroupInformation.java | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index 17b44e07e61..44dc680885f 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -27,6 +27,8 @@ Release 2.3.0 - UNRELEASED OPTIMIZATIONS + HADOOP-9748. Reduce blocking on UGI.ensureInitialized (daryn) + BUG FIXES HADOOP-9582. Non-existent file to "hadoop fs -conf" doesn't throw error diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/UserGroupInformation.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/UserGroupInformation.java index 6525911c125..c1689bd94cd 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/UserGroupInformation.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/UserGroupInformation.java @@ -208,9 +208,13 @@ public class UserGroupInformation { * A method to initialize the fields that depend on a configuration. * Must be called before useKerberos or groups is used. */ - private static synchronized void ensureInitialized() { + private static void ensureInitialized() { if (conf == null) { - initialize(new Configuration(), false); + synchronized(UserGroupInformation.class) { + if (conf == null) { // someone might have beat us + initialize(new Configuration(), false); + } + } } }