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:
parent
3a089cf356
commit
070916130a
@ -173,6 +173,8 @@ Release 2.0.5-alpha - UNRELEASED
|
|||||||
MAPREDUCE-5113. Streaming input/output types are ignored with java
|
MAPREDUCE-5113. Streaming input/output types are ignored with java
|
||||||
mapper/reducer. (sandyr via tucu)
|
mapper/reducer. (sandyr via tucu)
|
||||||
|
|
||||||
|
MAPREDUCE-5098. Fix findbugs warnings in gridmix. (kkambatl via tucu)
|
||||||
|
|
||||||
Release 2.0.4-beta - UNRELEASED
|
Release 2.0.4-beta - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
33
hadoop-tools/hadoop-gridmix/dev-support/findbugs-exclude.xml
Normal file
33
hadoop-tools/hadoop-gridmix/dev-support/findbugs-exclude.xml
Normal 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>
|
@ -100,6 +100,16 @@
|
|||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<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>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-antrun-plugin</artifactId>
|
<artifactId>maven-antrun-plugin</artifactId>
|
||||||
|
@ -86,9 +86,7 @@ public JobMonitor(int pollDelay, TimeUnit unit, Statistics statistics,
|
|||||||
* Add a running job's status to the polling queue.
|
* Add a running job's status to the polling queue.
|
||||||
*/
|
*/
|
||||||
public void add(JobStats job) throws InterruptedException {
|
public void add(JobStats job) throws InterruptedException {
|
||||||
synchronized (runningJobs) {
|
|
||||||
runningJobs.put(job);
|
runningJobs.put(job);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -147,12 +145,10 @@ public void run() {
|
|||||||
boolean shutdown;
|
boolean shutdown;
|
||||||
while (true) {
|
while (true) {
|
||||||
try {
|
try {
|
||||||
synchronized (runningJobs) {
|
synchronized (mJobs) {
|
||||||
synchronized (mJobs) {
|
graceful = JobMonitor.this.graceful;
|
||||||
graceful = JobMonitor.this.graceful;
|
shutdown = JobMonitor.this.shutdown;
|
||||||
shutdown = JobMonitor.this.shutdown;
|
runningJobs.drainTo(mJobs);
|
||||||
runningJobs.drainTo(mJobs);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// shutdown conditions; either shutdown requested and all jobs
|
// shutdown conditions; either shutdown requested and all jobs
|
||||||
@ -160,11 +156,9 @@ public void run() {
|
|||||||
// submitted jobs not in the monitored set
|
// submitted jobs not in the monitored set
|
||||||
if (shutdown) {
|
if (shutdown) {
|
||||||
if (!graceful) {
|
if (!graceful) {
|
||||||
synchronized (runningJobs) {
|
while (!runningJobs.isEmpty()) {
|
||||||
while (!runningJobs.isEmpty()) {
|
synchronized (mJobs) {
|
||||||
synchronized (mJobs) {
|
runningJobs.drainTo(mJobs);
|
||||||
runningJobs.drainTo(mJobs);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -84,7 +84,7 @@ public SleepJob(Configuration conf, long submissionMillis, JobStory jobdesc,
|
|||||||
String[] hosts) throws IOException {
|
String[] hosts) throws IOException {
|
||||||
super(conf, submissionMillis, jobdesc, outRoot, ugi, seq);
|
super(conf, submissionMillis, jobdesc, outRoot, ugi, seq);
|
||||||
this.fakeLocations = numLocations;
|
this.fakeLocations = numLocations;
|
||||||
this.hosts = hosts;
|
this.hosts = hosts.clone();
|
||||||
this.selector = (fakeLocations > 0)? new Selector(hosts.length, (float) fakeLocations
|
this.selector = (fakeLocations > 0)? new Selector(hosts.length, (float) fakeLocations
|
||||||
/ hosts.length, rand.get()) : null;
|
/ hosts.length, rand.get()) : null;
|
||||||
this.mapTasksOnly = conf.getBoolean(SLEEPJOB_MAPTASK_ONLY, false);
|
this.mapTasksOnly = conf.getBoolean(SLEEPJOB_MAPTASK_ONLY, false);
|
||||||
@ -289,9 +289,9 @@ public SleepSplit(
|
|||||||
this.id = id;
|
this.id = id;
|
||||||
this.sleepDuration = sleepDuration;
|
this.sleepDuration = sleepDuration;
|
||||||
nSpec = reduceDurations.length;
|
nSpec = reduceDurations.length;
|
||||||
this.reduceDurations = reduceDurations;
|
this.reduceDurations = reduceDurations.clone();
|
||||||
this.nMaps = nMaps;
|
this.nMaps = nMaps;
|
||||||
this.locations = locations;
|
this.locations = locations.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -349,7 +349,7 @@ public long getReduceDurations(int i) {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] getLocations() {
|
public String[] getLocations() {
|
||||||
return locations;
|
return locations.clone();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ public class TotalHeapUsageEmulatorPlugin
|
|||||||
|
|
||||||
private static final float DEFAULT_HEAP_LOAD_RATIO = 0.1F;
|
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
|
* Defines the core heap usage emulation algorithm. This engine is expected
|
||||||
@ -129,7 +129,8 @@ public void initialize(ResourceCalculatorPlugin monitor,
|
|||||||
public static class DefaultHeapUsageEmulator
|
public static class DefaultHeapUsageEmulator
|
||||||
implements HeapUsageEmulatorCore {
|
implements HeapUsageEmulatorCore {
|
||||||
// store the unit loads in a list
|
// 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.
|
* Increase heap usage by current process by the given amount.
|
||||||
|
Loading…
Reference in New Issue
Block a user