YARN-1597. Fixed Findbugs warnings on branch YARN-321. Contributed by Vinod Kumar Vavilapalli.

svn merge --ignore-ancestry -c 1557958 ../YARN-321


git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1562217 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Vinod Kumar Vavilapalli 2014-01-28 20:17:27 +00:00
parent ff83e97655
commit b786be0307
4 changed files with 17 additions and 12 deletions

View File

@ -81,6 +81,9 @@ Branch YARN-321: Generic ApplicationHistoryService
YARN-1596. Fixed Javadoc warnings on branch YARN-321. (Vinod Kumar Vavilapalli YARN-1596. Fixed Javadoc warnings on branch YARN-321. (Vinod Kumar Vavilapalli
via zjshen) via zjshen)
YARN-1597. Fixed Findbugs warnings on branch YARN-321. (Vinod Kumar Vavilapalli
via zjshen)
Release 2.4.0 - UNRELEASED Release 2.4.0 - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -21,6 +21,7 @@ package org.apache.hadoop.yarn.server.applicationhistoryservice;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
@ -94,9 +95,10 @@ public class ApplicationHistoryManagerImpl extends AbstractService implements
Map<ApplicationId, ApplicationHistoryData> histData = historyStore Map<ApplicationId, ApplicationHistoryData> histData = historyStore
.getAllApplications(); .getAllApplications();
HashMap<ApplicationId, ApplicationReport> applicationsReport = new HashMap<ApplicationId, ApplicationReport>(); HashMap<ApplicationId, ApplicationReport> applicationsReport = new HashMap<ApplicationId, ApplicationReport>();
for (ApplicationId appId : histData.keySet()) { for (Entry<ApplicationId, ApplicationHistoryData> entry : histData
applicationsReport.put(appId, convertToApplicationReport(histData .entrySet()) {
.get(appId))); applicationsReport.put(entry.getKey(),
convertToApplicationReport(entry.getValue()));
} }
return applicationsReport; return applicationsReport;
} }
@ -171,9 +173,10 @@ public class ApplicationHistoryManagerImpl extends AbstractService implements
Map<ApplicationAttemptId, ApplicationAttemptHistoryData> histData = historyStore Map<ApplicationAttemptId, ApplicationAttemptHistoryData> histData = historyStore
.getApplicationAttempts(appId); .getApplicationAttempts(appId);
HashMap<ApplicationAttemptId, ApplicationAttemptReport> applicationAttemptsReport = new HashMap<ApplicationAttemptId, ApplicationAttemptReport>(); HashMap<ApplicationAttemptId, ApplicationAttemptReport> applicationAttemptsReport = new HashMap<ApplicationAttemptId, ApplicationAttemptReport>();
for (ApplicationAttemptId appAttemptId : histData.keySet()) { for (Entry<ApplicationAttemptId, ApplicationAttemptHistoryData> entry : histData
applicationAttemptsReport.put(appAttemptId, .entrySet()) {
convertToApplicationAttemptReport(histData.get(appAttemptId))); applicationAttemptsReport.put(entry.getKey(),
convertToApplicationAttemptReport(entry.getValue()));
} }
return applicationAttemptsReport; return applicationAttemptsReport;
} }
@ -201,9 +204,9 @@ public class ApplicationHistoryManagerImpl extends AbstractService implements
Map<ContainerId, ContainerHistoryData> histData = historyStore Map<ContainerId, ContainerHistoryData> histData = historyStore
.getContainers(appAttemptId); .getContainers(appAttemptId);
HashMap<ContainerId, ContainerReport> containersReport = new HashMap<ContainerId, ContainerReport>(); HashMap<ContainerId, ContainerReport> containersReport = new HashMap<ContainerId, ContainerReport>();
for (ContainerId container : histData.keySet()) { for (Entry<ContainerId, ContainerHistoryData> entry : histData.entrySet()) {
containersReport.put(container, convertToContainerReport(histData containersReport.put(entry.getKey(),
.get(container))); convertToContainerReport(entry.getValue()));
} }
return containersReport; return containersReport;
} }

View File

@ -739,7 +739,6 @@ public class FileSystemApplicationHistoryStore extends AbstractService
} }
} }
private FSDataInputStream fsdis;
private TFile.Reader reader; private TFile.Reader reader;
private TFile.Reader.Scanner scanner; private TFile.Reader.Scanner scanner;
@ -773,7 +772,7 @@ public class FileSystemApplicationHistoryStore extends AbstractService
} }
public void close() { public void close() {
IOUtils.cleanup(LOG, scanner, reader, fsdis); IOUtils.cleanup(LOG, scanner, reader);
} }
} }

View File

@ -319,7 +319,7 @@ public class RMApplicationHistoryWriter extends CompositeService {
// dispatcher, such that all the writing events of one application will // dispatcher, such that all the writing events of one application will
// be handled by one thread, the scheduled order of the these events // be handled by one thread, the scheduled order of the these events
// will be preserved // will be preserved
int index = Math.abs(event.hashCode()) % dispatchers.size(); int index = (event.hashCode() & Integer.MAX_VALUE) % dispatchers.size();
dispatchers.get(index).getEventHandler().handle(event); dispatchers.get(index).getEventHandler().handle(event);
} }