YARN-10820. Make GetClusterNodesRequestPBImpl thread safe. Contributed by Swathi Chandrashekar.
(cherry picked from commit 6b4987f09c
)
This commit is contained in:
parent
f6b3361b4b
commit
edfd68e248
|
@ -52,7 +52,7 @@ public class GetClusterNodesRequestPBImpl extends GetClusterNodesRequest {
|
||||||
viaProto = true;
|
viaProto = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GetClusterNodesRequestProto getProto() {
|
public synchronized GetClusterNodesRequestProto getProto() {
|
||||||
mergeLocalToProto();
|
mergeLocalToProto();
|
||||||
proto = viaProto ? proto : builder.build();
|
proto = viaProto ? proto : builder.build();
|
||||||
viaProto = true;
|
viaProto = true;
|
||||||
|
@ -60,13 +60,13 @@ public class GetClusterNodesRequestPBImpl extends GetClusterNodesRequest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumSet<NodeState> getNodeStates() {
|
public synchronized EnumSet<NodeState> getNodeStates() {
|
||||||
initNodeStates();
|
initNodeStates();
|
||||||
return this.states;
|
return this.states;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setNodeStates(final EnumSet<NodeState> states) {
|
public synchronized void setNodeStates(final EnumSet<NodeState> states) {
|
||||||
initNodeStates();
|
initNodeStates();
|
||||||
this.states.clear();
|
this.states.clear();
|
||||||
if (states == null) {
|
if (states == null) {
|
||||||
|
|
Loading…
Reference in New Issue