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