YARN-6263. NMTokenSecretManagerInRM.createAndGetNMToken is not thread safe. Contributed by Haibo Chen

This commit is contained in:
Jason Lowe 2017-03-03 08:23:08 -06:00
parent 05237636d3
commit e58fc76030
1 changed files with 2 additions and 2 deletions

View File

@ -192,7 +192,7 @@ public class NMTokenSecretManagerInRM extends BaseNMTokenSecretManager {
public NMToken createAndGetNMToken(String applicationSubmitter,
ApplicationAttemptId appAttemptId, Container container) {
try {
this.readLock.lock();
this.writeLock.lock();
HashSet<NodeId> nodeSet = this.appAttemptToNodeKeyMap.get(appAttemptId);
NMToken nmToken = null;
if (nodeSet != null) {
@ -208,7 +208,7 @@ public class NMTokenSecretManagerInRM extends BaseNMTokenSecretManager {
}
return nmToken;
} finally {
this.readLock.unlock();
this.writeLock.unlock();
}
}