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

This commit is contained in:
Arun Suresh 2016-05-16 23:22:01 -07:00
parent 2c91fd8241
commit ccc93e7812
5 changed files with 16 additions and 10 deletions

View File

@ -327,7 +327,7 @@
<Bug pattern="DM_EXIT" />
</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" />
<Bug pattern="DM_EXIT" />
</Match>

View File

@ -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;

View File

@ -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);
}

View File

@ -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() {

View File

@ -170,7 +170,7 @@ public void updateNodeHeartbeatResponseForContainersDecreasing(
public List<Container> pullNewlyIncreasedContainers();
public QueuedContainersStatus getQueuedContainersStatus();
QueuedContainersStatus getQueuedContainersStatus();
long getUntrackedTimeStamp();