MAPREDUCE-5098. Fix findbugs warnings in gridmix. (kkambatl via tucu)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1464209 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Alejandro Abdelnur 2013-04-03 21:22:02 +00:00
parent 3a089cf356
commit 070916130a
6 changed files with 59 additions and 19 deletions

View File

@ -173,6 +173,8 @@ Release 2.0.5-alpha - UNRELEASED
MAPREDUCE-5113. Streaming input/output types are ignored with java
mapper/reducer. (sandyr via tucu)
MAPREDUCE-5098. Fix findbugs warnings in gridmix. (kkambatl via tucu)
Release 2.0.4-beta - UNRELEASED
INCOMPATIBLE CHANGES

View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<FindBugsFilter>
<!-- Ignore some irrelevant serialization warnings -->
<Match>
<Class name="org.apache.hadoop.mapred.gridmix.GridmixRecord$Comparator" />
<Bug pattern="SE_COMPARATOR_SHOULD_BE_SERIALIZABLE" />
</Match>
<!-- The called methods actually might throw Exceptions -->
<Match>
<Class name="org.apache.hadoop.mapred.gridmix.ExecutionSummarizer"/>
<Method name="processJobState"/>
<Bug pattern="REC_CATCH_EXCEPTION"/>
<Bug code="REC"/>
</Match>
</FindBugsFilter>

View File

@ -100,6 +100,16 @@
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<configuration>
<findbugsXmlOutput>true</findbugsXmlOutput>
<xmlOutput>true</xmlOutput>
<excludeFilterFile>${basedir}/dev-support/findbugs-exclude.xml</excludeFilterFile>
<effort>Max</effort>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>

View File

@ -86,10 +86,8 @@ public JobMonitor(int pollDelay, TimeUnit unit, Statistics statistics,
* Add a running job's status to the polling queue.
*/
public void add(JobStats job) throws InterruptedException {
synchronized (runningJobs) {
runningJobs.put(job);
}
}
/**
* Add a submission failed job's status, such that it can be communicated
@ -147,26 +145,22 @@ public void run() {
boolean shutdown;
while (true) {
try {
synchronized (runningJobs) {
synchronized (mJobs) {
graceful = JobMonitor.this.graceful;
shutdown = JobMonitor.this.shutdown;
runningJobs.drainTo(mJobs);
}
}
// shutdown conditions; either shutdown requested and all jobs
// have completed or abort requested and there are recently
// submitted jobs not in the monitored set
if (shutdown) {
if (!graceful) {
synchronized (runningJobs) {
while (!runningJobs.isEmpty()) {
synchronized (mJobs) {
runningJobs.drainTo(mJobs);
}
}
}
break;
}

View File

@ -84,7 +84,7 @@ public SleepJob(Configuration conf, long submissionMillis, JobStory jobdesc,
String[] hosts) throws IOException {
super(conf, submissionMillis, jobdesc, outRoot, ugi, seq);
this.fakeLocations = numLocations;
this.hosts = hosts;
this.hosts = hosts.clone();
this.selector = (fakeLocations > 0)? new Selector(hosts.length, (float) fakeLocations
/ hosts.length, rand.get()) : null;
this.mapTasksOnly = conf.getBoolean(SLEEPJOB_MAPTASK_ONLY, false);
@ -289,9 +289,9 @@ public SleepSplit(
this.id = id;
this.sleepDuration = sleepDuration;
nSpec = reduceDurations.length;
this.reduceDurations = reduceDurations;
this.reduceDurations = reduceDurations.clone();
this.nMaps = nMaps;
this.locations = locations;
this.locations = locations.clone();
}
@Override
@ -349,7 +349,7 @@ public long getReduceDurations(int i) {
@Override
public String[] getLocations() {
return locations;
return locations.clone();
}
}

View File

@ -93,7 +93,7 @@ public class TotalHeapUsageEmulatorPlugin
private static final float DEFAULT_HEAP_LOAD_RATIO = 0.1F;
public static int ONE_MB = 1024 * 1024;
public static final int ONE_MB = 1024 * 1024;
/**
* Defines the core heap usage emulation algorithm. This engine is expected
@ -129,7 +129,8 @@ public void initialize(ResourceCalculatorPlugin monitor,
public static class DefaultHeapUsageEmulator
implements HeapUsageEmulatorCore {
// store the unit loads in a list
protected static ArrayList<Object> heapSpace = new ArrayList<Object>();
protected static final ArrayList<Object> heapSpace =
new ArrayList<Object>();
/**
* Increase heap usage by current process by the given amount.