From efc83da2a0d8d881904250fb896d45b383a3adf6 Mon Sep 17 00:00:00 2001 From: Jitendra Nath Pandey Date: Thu, 1 Dec 2011 01:13:42 +0000 Subject: [PATCH] HADOOP-7854. UGI getCurrentUser is not synchronized. Contributed by Daryn Sharp. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1208926 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-common-project/hadoop-common/CHANGES.txt | 2 ++ .../java/org/apache/hadoop/security/UserGroupInformation.java | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index 4e37c55b85b..7c0d4a007b8 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -150,6 +150,8 @@ Release 0.23.1 - Unreleased HADOOP-7864. Building mvn site with Maven < 3.0.2 causes OOM errors. (Andrew Bayer via eli) + HADOOP-7854. UGI getCurrentUser is not synchronized. (Daryn Sharp via jitendra) + Release 0.23.0 - 2011-11-01 INCOMPATIBLE CHANGES 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 344c08e2b66..b272e80fac6 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 @@ -449,7 +449,8 @@ public class UserGroupInformation { * @return the current user * @throws IOException if login fails */ - public static UserGroupInformation getCurrentUser() throws IOException { + public synchronized + static UserGroupInformation getCurrentUser() throws IOException { AccessControlContext context = AccessController.getContext(); Subject subject = Subject.getSubject(context); if (subject == null || subject.getPrincipals(User.class).isEmpty()) {