Browse Source

YARN-5075. Fix findbugs warnings in hadoop-yarn-common module. (asuresh)

Arun Suresh 9 years ago
parent
commit
ccc93e7812

+ 1 - 1
hadoop-yarn-project/hadoop-yarn/dev-support/findbugs-exclude.xml

@@ -327,7 +327,7 @@
     <Bug pattern="DM_EXIT" />
     <Bug pattern="DM_EXIT" />
   </Match>
   </Match>
   <Match>
   <Match>
-    <Class name="org.apache.hadoop.yarn.server.resourcemanager.ResourceManager$SchedulerEventDispatcher$EventProcessor" />
+    <Class name="org.apache.hadoop.yarn.event.EventDispatcher$EventProcessor" />
     <Method name="run" />
     <Method name="run" />
     <Bug pattern="DM_EXIT" />
     <Bug pattern="DM_EXIT" />
   </Match>
   </Match>

+ 1 - 1
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java

@@ -339,7 +339,7 @@ public class YarnConfiguration extends Configuration {
       600000;
       600000;
 
 
   /** K least loaded nodes to be provided to the LocalScheduler of a
   /** 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 =
   public static final String DIST_SCHEDULING_TOP_K =
       YARN_PREFIX + "distributed-scheduling.top-k";
       YARN_PREFIX + "distributed-scheduling.top-k";
   public static final int DIST_SCHEDULING_TOP_K_DEFAULT = 10;
   public static final int DIST_SCHEDULING_TOP_K_DEFAULT = 10;

+ 8 - 6
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.ApplicationIdProto;
 import org.apache.hadoop.yarn.proto.YarnProtos.ContainerStatusProto;
 import org.apache.hadoop.yarn.proto.YarnProtos.ContainerStatusProto;
 import org.apache.hadoop.yarn.proto.YarnProtos.ContainerProto;
 import org.apache.hadoop.yarn.proto.YarnProtos.ContainerProto;
 import org.apache.hadoop.yarn.proto.YarnProtos.NodeIdProto;
 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.NodeHealthStatusProto;
 import org.apache.hadoop.yarn.proto.YarnServerCommonProtos.NodeStatusProto;
 import org.apache.hadoop.yarn.proto.YarnServerCommonProtos.NodeStatusProto;
 import org.apache.hadoop.yarn.proto.YarnServerCommonProtos.NodeStatusProtoOrBuilder;
 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.QueuedContainersStatus;
 import org.apache.hadoop.yarn.server.api.records.NodeHealthStatus;
 import org.apache.hadoop.yarn.server.api.records.NodeHealthStatus;
@@ -404,7 +404,7 @@ public class NodeStatusPBImpl extends NodeStatus {
   }
   }
 
 
   @Override
   @Override
-  public QueuedContainersStatus getQueuedContainersStatus() {
+  public synchronized QueuedContainersStatus getQueuedContainersStatus() {
     NodeStatusProtoOrBuilder p =
     NodeStatusProtoOrBuilder p =
         this.viaProto ? this.proto : this.builder;
         this.viaProto ? this.proto : this.builder;
     if (!p.hasQueuedContainerStatus()) {
     if (!p.hasQueuedContainerStatus()) {
@@ -414,7 +414,8 @@ public class NodeStatusPBImpl extends NodeStatus {
   }
   }
 
 
   @Override
   @Override
-  public void setQueuedContainersStatus(QueuedContainersStatus queuedContainersStatus) {
+  public synchronized void setQueuedContainersStatus(
+      QueuedContainersStatus queuedContainersStatus) {
     maybeInitBuilder();
     maybeInitBuilder();
     if (queuedContainersStatus == null) {
     if (queuedContainersStatus == null) {
       this.builder.clearQueuedContainerStatus();
       this.builder.clearQueuedContainerStatus();
@@ -457,7 +458,8 @@ public class NodeStatusPBImpl extends NodeStatus {
     return ((ApplicationIdPBImpl)c).getProto();
     return ((ApplicationIdPBImpl)c).getProto();
   }
   }
 
 
-  private YarnProtos.ResourceUtilizationProto convertToProtoFormat(ResourceUtilization r) {
+  private YarnProtos.ResourceUtilizationProto convertToProtoFormat(
+      ResourceUtilization r) {
     return ((ResourceUtilizationPBImpl) r).getProto();
     return ((ResourceUtilizationPBImpl) r).getProto();
   }
   }
 
 
@@ -466,13 +468,13 @@ public class NodeStatusPBImpl extends NodeStatus {
     return new ResourceUtilizationPBImpl(p);
     return new ResourceUtilizationPBImpl(p);
   }
   }
 
 
-  private YarnServerCommonProtos.QueuedContainersStatusProto convertToProtoFormat(
+  private QueuedContainersStatusProto convertToProtoFormat(
       QueuedContainersStatus r) {
       QueuedContainersStatus r) {
     return ((QueuedContainersStatusPBImpl) r).getProto();
     return ((QueuedContainersStatusPBImpl) r).getProto();
   }
   }
 
 
   private QueuedContainersStatus convertFromProtoFormat(
   private QueuedContainersStatus convertFromProtoFormat(
-      YarnServerCommonProtos.QueuedContainersStatusProto p) {
+      QueuedContainersStatusProto p) {
     return new QueuedContainersStatusPBImpl(p);
     return new QueuedContainersStatusPBImpl(p);
   }
   }
 
 

+ 5 - 1
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 @@ package org.apache.hadoop.yarn.server.api.records.impl.pb;
 import org.apache.hadoop.yarn.proto.YarnServerCommonProtos;
 import org.apache.hadoop.yarn.proto.YarnServerCommonProtos;
 import org.apache.hadoop.yarn.server.api.records.QueuedContainersStatus;
 import org.apache.hadoop.yarn.server.api.records.QueuedContainersStatus;
 
 
+/**
+ * Protocol Buffer implementation of QueuedContainersStatus.
+ */
 public class QueuedContainersStatusPBImpl extends QueuedContainersStatus {
 public class QueuedContainersStatusPBImpl extends QueuedContainersStatus {
 
 
   private YarnServerCommonProtos.QueuedContainersStatusProto proto =
   private YarnServerCommonProtos.QueuedContainersStatusProto proto =
       YarnServerCommonProtos.QueuedContainersStatusProto.getDefaultInstance();
       YarnServerCommonProtos.QueuedContainersStatusProto.getDefaultInstance();
-  private YarnServerCommonProtos.QueuedContainersStatusProto.Builder builder = null;
+  private YarnServerCommonProtos.QueuedContainersStatusProto.Builder builder =
+      null;
   private boolean viaProto = false;
   private boolean viaProto = false;
 
 
   public QueuedContainersStatusPBImpl() {
   public QueuedContainersStatusPBImpl() {

+ 1 - 1
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 interface RMNode {
   
   
   public List<Container> pullNewlyIncreasedContainers();
   public List<Container> pullNewlyIncreasedContainers();
 
 
-  public QueuedContainersStatus getQueuedContainersStatus();
+  QueuedContainersStatus getQueuedContainersStatus();
 
 
   long getUntrackedTimeStamp();
   long getUntrackedTimeStamp();