YARN-4151. Fix findbugs errors in hadoop-yarn-server-common module. (Meng Ding via wangda)

(cherry picked from commit e2a0270217)
This commit is contained in:
Wangda Tan 2015-09-14 16:00:35 -07:00
parent 149d731559
commit e552775545
4 changed files with 17 additions and 6 deletions

View File

@ -774,6 +774,9 @@ Release 2.8.0 - UNRELEASED
YARN-4115. Reduce loglevel of ContainerManagementProtocolProxy to Debug YARN-4115. Reduce loglevel of ContainerManagementProtocolProxy to Debug
(adhoot via rkanter) (adhoot via rkanter)
YARN-4151. Fix findbugs errors in hadoop-yarn-server-common module.
(Meng Ding via wangda)
Release 2.7.2 - UNRELEASED Release 2.7.2 - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -293,7 +293,7 @@ public class NodeStatusPBImpl extends NodeStatus {
} }
@Override @Override
public ResourceUtilization getContainersUtilization() { public synchronized ResourceUtilization getContainersUtilization() {
NodeStatusProtoOrBuilder p = NodeStatusProtoOrBuilder p =
this.viaProto ? this.proto : this.builder; this.viaProto ? this.proto : this.builder;
if (!p.hasContainersUtilization()) { if (!p.hasContainersUtilization()) {
@ -303,7 +303,7 @@ public class NodeStatusPBImpl extends NodeStatus {
} }
@Override @Override
public void setContainersUtilization( public synchronized void setContainersUtilization(
ResourceUtilization containersUtilization) { ResourceUtilization containersUtilization) {
maybeInitBuilder(); maybeInitBuilder();
if (containersUtilization == null) { if (containersUtilization == null) {
@ -315,7 +315,7 @@ public class NodeStatusPBImpl extends NodeStatus {
} }
@Override @Override
public ResourceUtilization getNodeUtilization() { public synchronized ResourceUtilization getNodeUtilization() {
NodeStatusProtoOrBuilder p = NodeStatusProtoOrBuilder p =
this.viaProto ? this.proto : this.builder; this.viaProto ? this.proto : this.builder;
if (!p.hasNodeUtilization()) { if (!p.hasNodeUtilization()) {
@ -325,7 +325,7 @@ public class NodeStatusPBImpl extends NodeStatus {
} }
@Override @Override
public void setNodeUtilization( public synchronized void setNodeUtilization(
ResourceUtilization nodeUtilization) { ResourceUtilization nodeUtilization) {
maybeInitBuilder(); maybeInitBuilder();
if (nodeUtilization == null) { if (nodeUtilization == null) {

View File

@ -51,8 +51,7 @@ public class WebPageUtils {
sb.append("[\n") sb.append("[\n")
.append("{'sType':'string', 'aTargets': [0]") .append("{'sType':'string', 'aTargets': [0]")
.append(", 'mRender': parseHadoopID }") .append(", 'mRender': parseHadoopID }")
.append("\n, {'sType':'numeric', 'aTargets': " + .append("\n, {'sType':'numeric', 'aTargets': [6, 7]")
(isFairSchedulerPage ? "[6, 7]": "[6, 7]"))
.append(", 'mRender': renderHadoopDate }") .append(", 'mRender': renderHadoopDate }")
.append("\n, {'sType':'numeric', bSearchable:false, 'aTargets':"); .append("\n, {'sType':'numeric', bSearchable:false, 'aTargets':");
if (isFairSchedulerPage) { if (isFairSchedulerPage) {

View File

@ -167,6 +167,9 @@ public class WebServices {
} catch (Exception e) { } catch (Exception e) {
rewrapAndThrowException(e); rewrapAndThrowException(e);
} }
if (appReports == null) {
return allApps;
}
for (ApplicationReport appReport : appReports) { for (ApplicationReport appReport : appReports) {
if (checkAppStates && if (checkAppStates &&
@ -266,6 +269,9 @@ public class WebServices {
rewrapAndThrowException(e); rewrapAndThrowException(e);
} }
AppAttemptsInfo appAttemptsInfo = new AppAttemptsInfo(); AppAttemptsInfo appAttemptsInfo = new AppAttemptsInfo();
if (appAttemptReports == null) {
return appAttemptsInfo;
}
for (ApplicationAttemptReport appAttemptReport : appAttemptReports) { for (ApplicationAttemptReport appAttemptReport : appAttemptReports) {
AppAttemptInfo appAttemptInfo = new AppAttemptInfo(appAttemptReport); AppAttemptInfo appAttemptInfo = new AppAttemptInfo(appAttemptReport);
appAttemptsInfo.add(appAttemptInfo); appAttemptsInfo.add(appAttemptInfo);
@ -336,6 +342,9 @@ public class WebServices {
rewrapAndThrowException(e); rewrapAndThrowException(e);
} }
ContainersInfo containersInfo = new ContainersInfo(); ContainersInfo containersInfo = new ContainersInfo();
if (containerReports == null) {
return containersInfo;
}
for (ContainerReport containerReport : containerReports) { for (ContainerReport containerReport : containerReports) {
ContainerInfo containerInfo = new ContainerInfo(containerReport); ContainerInfo containerInfo = new ContainerInfo(containerReport);
containersInfo.add(containerInfo); containersInfo.add(containerInfo);