From ccc93e78127c14bfd84179395b055c4061ea436a Mon Sep 17 00:00:00 2001 From: Arun Suresh Date: Mon, 16 May 2016 23:22:01 -0700 Subject: [PATCH] YARN-5075. Fix findbugs warnings in hadoop-yarn-common module. (asuresh) --- .../hadoop-yarn/dev-support/findbugs-exclude.xml | 2 +- .../apache/hadoop/yarn/conf/YarnConfiguration.java | 2 +- .../api/records/impl/pb/NodeStatusPBImpl.java | 14 ++++++++------ .../impl/pb/QueuedContainersStatusPBImpl.java | 6 +++++- .../yarn/server/resourcemanager/rmnode/RMNode.java | 2 +- 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/hadoop-yarn-project/hadoop-yarn/dev-support/findbugs-exclude.xml b/hadoop-yarn-project/hadoop-yarn/dev-support/findbugs-exclude.xml index c640d9f79b..81c7e6aa32 100644 --- a/hadoop-yarn-project/hadoop-yarn/dev-support/findbugs-exclude.xml +++ b/hadoop-yarn-project/hadoop-yarn/dev-support/findbugs-exclude.xml @@ -327,7 +327,7 @@ - + diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java index 0b150c2cc9..cfe2897ac1 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java @@ -339,7 +339,7 @@ public static boolean isAclEnabled(Configuration conf) { 600000; /** K least loaded nodes to be provided to the LocalScheduler of a - * NodeManager for Distributed Scheduling */ + * NodeManager for Distributed Scheduling. */ public static final String DIST_SCHEDULING_TOP_K = YARN_PREFIX + "distributed-scheduling.top-k"; public static final int DIST_SCHEDULING_TOP_K_DEFAULT = 10; diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/records/impl/pb/NodeStatusPBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/records/impl/pb/NodeStatusPBImpl.java index 9a9a83ac57..d6a17370bd 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/records/impl/pb/NodeStatusPBImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/records/impl/pb/NodeStatusPBImpl.java @@ -38,10 +38,10 @@ import org.apache.hadoop.yarn.proto.YarnProtos.ContainerStatusProto; import org.apache.hadoop.yarn.proto.YarnProtos.ContainerProto; import org.apache.hadoop.yarn.proto.YarnProtos.NodeIdProto; -import org.apache.hadoop.yarn.proto.YarnServerCommonProtos; import org.apache.hadoop.yarn.proto.YarnServerCommonProtos.NodeHealthStatusProto; import org.apache.hadoop.yarn.proto.YarnServerCommonProtos.NodeStatusProto; import org.apache.hadoop.yarn.proto.YarnServerCommonProtos.NodeStatusProtoOrBuilder; +import org.apache.hadoop.yarn.proto.YarnServerCommonProtos.QueuedContainersStatusProto; import org.apache.hadoop.yarn.server.api.records.QueuedContainersStatus; import org.apache.hadoop.yarn.server.api.records.NodeHealthStatus; @@ -404,7 +404,7 @@ public synchronized void setIncreasedContainers( } @Override - public QueuedContainersStatus getQueuedContainersStatus() { + public synchronized QueuedContainersStatus getQueuedContainersStatus() { NodeStatusProtoOrBuilder p = this.viaProto ? this.proto : this.builder; if (!p.hasQueuedContainerStatus()) { @@ -414,7 +414,8 @@ public QueuedContainersStatus getQueuedContainersStatus() { } @Override - public void setQueuedContainersStatus(QueuedContainersStatus queuedContainersStatus) { + public synchronized void setQueuedContainersStatus( + QueuedContainersStatus queuedContainersStatus) { maybeInitBuilder(); if (queuedContainersStatus == null) { this.builder.clearQueuedContainerStatus(); @@ -457,7 +458,8 @@ private ApplicationIdProto convertToProtoFormat(ApplicationId c) { return ((ApplicationIdPBImpl)c).getProto(); } - private YarnProtos.ResourceUtilizationProto convertToProtoFormat(ResourceUtilization r) { + private YarnProtos.ResourceUtilizationProto convertToProtoFormat( + ResourceUtilization r) { return ((ResourceUtilizationPBImpl) r).getProto(); } @@ -466,13 +468,13 @@ private ResourceUtilizationPBImpl convertFromProtoFormat( return new ResourceUtilizationPBImpl(p); } - private YarnServerCommonProtos.QueuedContainersStatusProto convertToProtoFormat( + private QueuedContainersStatusProto convertToProtoFormat( QueuedContainersStatus r) { return ((QueuedContainersStatusPBImpl) r).getProto(); } private QueuedContainersStatus convertFromProtoFormat( - YarnServerCommonProtos.QueuedContainersStatusProto p) { + QueuedContainersStatusProto p) { return new QueuedContainersStatusPBImpl(p); } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/records/impl/pb/QueuedContainersStatusPBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/records/impl/pb/QueuedContainersStatusPBImpl.java index 54470f436c..16b80dd247 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/records/impl/pb/QueuedContainersStatusPBImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/records/impl/pb/QueuedContainersStatusPBImpl.java @@ -21,11 +21,15 @@ import org.apache.hadoop.yarn.proto.YarnServerCommonProtos; import org.apache.hadoop.yarn.server.api.records.QueuedContainersStatus; +/** + * Protocol Buffer implementation of QueuedContainersStatus. + */ public class QueuedContainersStatusPBImpl extends QueuedContainersStatus { private YarnServerCommonProtos.QueuedContainersStatusProto proto = YarnServerCommonProtos.QueuedContainersStatusProto.getDefaultInstance(); - private YarnServerCommonProtos.QueuedContainersStatusProto.Builder builder = null; + private YarnServerCommonProtos.QueuedContainersStatusProto.Builder builder = + null; private boolean viaProto = false; public QueuedContainersStatusPBImpl() { diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmnode/RMNode.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmnode/RMNode.java index 0e281d84bb..3a9cf54f4a 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmnode/RMNode.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmnode/RMNode.java @@ -170,7 +170,7 @@ public void updateNodeHeartbeatResponseForContainersDecreasing( public List pullNewlyIncreasedContainers(); - public QueuedContainersStatus getQueuedContainersStatus(); + QueuedContainersStatus getQueuedContainersStatus(); long getUntrackedTimeStamp();