YARN-6263. NMTokenSecretManagerInRM.createAndGetNMToken is not thread safe. Contributed by Haibo Chen
(cherry picked from commit e58fc76030
)
This commit is contained in:
parent
daf3b5ee67
commit
6c48440627
|
@ -192,7 +192,7 @@ public class NMTokenSecretManagerInRM extends BaseNMTokenSecretManager {
|
||||||
public NMToken createAndGetNMToken(String applicationSubmitter,
|
public NMToken createAndGetNMToken(String applicationSubmitter,
|
||||||
ApplicationAttemptId appAttemptId, Container container) {
|
ApplicationAttemptId appAttemptId, Container container) {
|
||||||
try {
|
try {
|
||||||
this.readLock.lock();
|
this.writeLock.lock();
|
||||||
HashSet<NodeId> nodeSet = this.appAttemptToNodeKeyMap.get(appAttemptId);
|
HashSet<NodeId> nodeSet = this.appAttemptToNodeKeyMap.get(appAttemptId);
|
||||||
NMToken nmToken = null;
|
NMToken nmToken = null;
|
||||||
if (nodeSet != null) {
|
if (nodeSet != null) {
|
||||||
|
@ -208,7 +208,7 @@ public class NMTokenSecretManagerInRM extends BaseNMTokenSecretManager {
|
||||||
}
|
}
|
||||||
return nmToken;
|
return nmToken;
|
||||||
} finally {
|
} finally {
|
||||||
this.readLock.unlock();
|
this.writeLock.unlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue