From 6b4987f09cbc53e00e85cb82ad97505858cada11 Mon Sep 17 00:00:00 2001 From: Prabhu Joseph Date: Thu, 17 Jun 2021 11:35:41 +0530 Subject: [PATCH] YARN-10820. Make GetClusterNodesRequestPBImpl thread safe. Contributed by Swathi Chandrashekar. --- .../impl/pb/GetClusterNodesRequestPBImpl.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/GetClusterNodesRequestPBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/GetClusterNodesRequestPBImpl.java index c817f05045..c25fbdfb44 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/GetClusterNodesRequestPBImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/GetClusterNodesRequestPBImpl.java @@ -52,7 +52,7 @@ public class GetClusterNodesRequestPBImpl extends GetClusterNodesRequest { viaProto = true; } - public GetClusterNodesRequestProto getProto() { + public synchronized GetClusterNodesRequestProto getProto() { mergeLocalToProto(); proto = viaProto ? proto : builder.build(); viaProto = true; @@ -60,13 +60,13 @@ public class GetClusterNodesRequestPBImpl extends GetClusterNodesRequest { } @Override - public EnumSet getNodeStates() { + public synchronized EnumSet getNodeStates() { initNodeStates(); return this.states; } @Override - public void setNodeStates(final EnumSet states) { + public synchronized void setNodeStates(final EnumSet states) { initNodeStates(); this.states.clear(); if (states == null) {