HADOOP-6652. Removes the unnecessary cache from ShellBasedUnixGroupsMapping. Contributed by Devaraj Das.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@954612 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6749f0275c
commit
e89ac4b077
@ -88,6 +88,9 @@ Trunk (unreleased changes)
|
|||||||
HADOOP-6682. NetUtils:normalizeHostName does not process hostnames starting
|
HADOOP-6682. NetUtils:normalizeHostName does not process hostnames starting
|
||||||
with [a-f] correctly. (jghoman)
|
with [a-f] correctly. (jghoman)
|
||||||
|
|
||||||
|
HADOOP-6652. Removes the unnecessary cache from ShellBasedUnixGroupsMapping.
|
||||||
|
(ddas)
|
||||||
|
|
||||||
Release 0.21.0 - Unreleased
|
Release 0.21.0 - Unreleased
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
@ -39,19 +39,12 @@ import org.apache.hadoop.util.Shell.ExitCodeException;
|
|||||||
@InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce"})
|
@InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce"})
|
||||||
@InterfaceStability.Evolving
|
@InterfaceStability.Evolving
|
||||||
public class ShellBasedUnixGroupsMapping implements GroupMappingServiceProvider {
|
public class ShellBasedUnixGroupsMapping implements GroupMappingServiceProvider {
|
||||||
Map<String, List<String>> userGroups =
|
|
||||||
new ConcurrentHashMap<String, List<String>>();
|
|
||||||
|
|
||||||
private static final Log LOG = LogFactory.getLog(ShellBasedUnixGroupsMapping.class);
|
private static final Log LOG = LogFactory.getLog(ShellBasedUnixGroupsMapping.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getGroups(String user) throws IOException {
|
public List<String> getGroups(String user) throws IOException {
|
||||||
List<String> groups = userGroups.get(user);
|
return getUnixGroups(user);
|
||||||
if (groups == null) {
|
|
||||||
groups = getUnixGroups(user);
|
|
||||||
userGroups.put(user, groups);
|
|
||||||
}
|
|
||||||
return groups;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user