svn merge -c 1569382 FIXES: HADOOP-10346. Deadlock while logging tokens. Contributed by Jason Lowe
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1569385 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9da50ec5e6
commit
d34f27becf
|
@ -56,6 +56,8 @@ Release 2.4.0 - UNRELEASED
|
|||
HADOOP-10249. LdapGroupsMapping should trim ldap password read from file.
|
||||
(Dilli Armugam via suresh)
|
||||
|
||||
HADOOP-10346. Deadlock while logging tokens (jlowe)
|
||||
|
||||
Release 2.3.1 - UNRELEASED
|
||||
|
||||
INCOMPATIBLE CHANGES
|
||||
|
|
|
@ -105,18 +105,21 @@ public class Token<T extends TokenIdentifier> implements Writable {
|
|||
return identifier;
|
||||
}
|
||||
|
||||
private static synchronized Class<? extends TokenIdentifier>
|
||||
private static Class<? extends TokenIdentifier>
|
||||
getClassForIdentifier(Text kind) {
|
||||
if (tokenKindMap == null) {
|
||||
tokenKindMap = Maps.newHashMap();
|
||||
for (TokenIdentifier id : ServiceLoader.load(TokenIdentifier.class)) {
|
||||
tokenKindMap.put(id.getKind(), id.getClass());
|
||||
Class<? extends TokenIdentifier> cls = null;
|
||||
synchronized (Token.class) {
|
||||
if (tokenKindMap == null) {
|
||||
tokenKindMap = Maps.newHashMap();
|
||||
for (TokenIdentifier id : ServiceLoader.load(TokenIdentifier.class)) {
|
||||
tokenKindMap.put(id.getKind(), id.getClass());
|
||||
}
|
||||
}
|
||||
cls = tokenKindMap.get(kind);
|
||||
}
|
||||
Class<? extends TokenIdentifier> cls = tokenKindMap.get(kind);
|
||||
if (cls == null) {
|
||||
LOG.warn("Cannot find class for token kind " + kind);
|
||||
return null;
|
||||
return null;
|
||||
}
|
||||
return cls;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue