YARN-5921. Incorrect synchronization in RMContextImpl#setHAServiceState/getHAServiceState. Contributed by Varun Saxena
(cherry picked from commit f3b8ff54ab08545d7093bf8861b44ec9912e8dc3)
This commit is contained in:
parent
2fdae7324b
commit
54c5880cf7
@ -79,6 +79,8 @@ public class RMContextImpl implements RMContext {
|
||||
|
||||
private QueueLimitCalculator queueLimitCalculator;
|
||||
|
||||
private final Object haServiceStateLock = new Object();
|
||||
|
||||
/**
|
||||
* Default constructor. To be used in conjunction with setter methods for
|
||||
* individual fields.
|
||||
@ -253,9 +255,9 @@ void setHAEnabled(boolean isHAEnabled) {
|
||||
this.isHAEnabled = isHAEnabled;
|
||||
}
|
||||
|
||||
void setHAServiceState(HAServiceState haServiceState) {
|
||||
synchronized (haServiceState) {
|
||||
this.haServiceState = haServiceState;
|
||||
void setHAServiceState(HAServiceState serviceState) {
|
||||
synchronized (haServiceStateLock) {
|
||||
this.haServiceState = serviceState;
|
||||
}
|
||||
}
|
||||
|
||||
@ -351,7 +353,7 @@ public boolean isHAEnabled() {
|
||||
|
||||
@Override
|
||||
public HAServiceState getHAServiceState() {
|
||||
synchronized (haServiceState) {
|
||||
synchronized (haServiceStateLock) {
|
||||
return haServiceState;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user