hadoop-mapreduce-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maha...@apache.org
Subject svn commit: r1153759 - in /hadoop/common/branches/MR-279/mapreduce: ./ mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapred/ mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/ mr-cli...
Date Thu, 04 Aug 2011 05:59:30 GMT
Author: mahadev
Date: Thu Aug  4 05:59:29 2011
New Revision: 1153759

URL: http://svn.apache.org/viewvc?rev=1153759&view=rev
Log:
Fix findbugs warnings in mr-client modules, part 1  (mahadev)

Modified:
    hadoop/common/branches/MR-279/mapreduce/CHANGES.txt
    hadoop/common/branches/MR-279/mapreduce/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapred/LocalContainerLauncher.java
    hadoop/common/branches/MR-279/mapreduce/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapred/MapReduceChildJVM.java
    hadoop/common/branches/MR-279/mapreduce/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/JobImpl.java
    hadoop/common/branches/MR-279/mapreduce/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/TaskAttemptImpl.java
    hadoop/common/branches/MR-279/mapreduce/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/rm/RMCommunicator.java
    hadoop/common/branches/MR-279/mapreduce/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/speculate/DataStatistics.java
    hadoop/common/branches/MR-279/mapreduce/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/speculate/LegacyTaskRuntimeEstimator.java
    hadoop/common/branches/MR-279/mapreduce/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/speculate/StartEndTimesBase.java
    hadoop/common/branches/MR-279/mapreduce/mr-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/JobHistory.java

Modified: hadoop/common/branches/MR-279/mapreduce/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/MR-279/mapreduce/CHANGES.txt?rev=1153759&r1=1153758&r2=1153759&view=diff
==============================================================================
--- hadoop/common/branches/MR-279/mapreduce/CHANGES.txt (original)
+++ hadoop/common/branches/MR-279/mapreduce/CHANGES.txt Thu Aug  4 05:59:29 2011
@@ -3,7 +3,9 @@ Hadoop MapReduce Change Log
 Trunk (unreleased changes)
 
   MAPREDUCE-279
-    
+ 
+    Fix findbugs warnings in mr-client modules, part 1  (mahadev) 
+  
     MAPREDUCE-2776. Fix some of the yarn findbug warnings. (siddharth 
     seth via mahadev)
 

Modified: hadoop/common/branches/MR-279/mapreduce/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapred/LocalContainerLauncher.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/MR-279/mapreduce/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapred/LocalContainerLauncher.java?rev=1153759&r1=1153758&r2=1153759&view=diff
==============================================================================
--- hadoop/common/branches/MR-279/mapreduce/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapred/LocalContainerLauncher.java
(original)
+++ hadoop/common/branches/MR-279/mapreduce/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapred/LocalContainerLauncher.java
Thu Aug  4 05:59:29 2011
@@ -64,7 +64,7 @@ import org.apache.hadoop.yarn.service.Ab
 public class LocalContainerLauncher extends AbstractService implements
     ContainerLauncher {
 
-  private static final File curDir = new File(new String("."));
+  private static final File curDir = new File(".");
   private static final Log LOG = LogFactory.getLog(LocalContainerLauncher.class);
 
   private FileContext curFC = null;

Modified: hadoop/common/branches/MR-279/mapreduce/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapred/MapReduceChildJVM.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/MR-279/mapreduce/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapred/MapReduceChildJVM.java?rev=1153759&r1=1153758&r2=1153759&view=diff
==============================================================================
--- hadoop/common/branches/MR-279/mapreduce/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapred/MapReduceChildJVM.java
(original)
+++ hadoop/common/branches/MR-279/mapreduce/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapred/MapReduceChildJVM.java
Thu Aug  4 05:59:29 2011
@@ -91,10 +91,12 @@ public class MapReduceChildJVM {
     Vector<String> logProps = new Vector<String>(4);
     setupLog4jProperties(logProps, logSize, containerLogDir);
     Iterator<String> it = logProps.iterator();
+    StringBuffer buffer = new StringBuffer();
     while (it.hasNext()) {
-      hadoopClientOpts += " " + it.next();
+      buffer.append(" " + it.next());
     }
-
+    hadoopClientOpts = hadoopClientOpts + buffer.toString();
+    
     env.put("HADOOP_CLIENT_OPTS", hadoopClientOpts);
 
     // add the env variables passed by the user

Modified: hadoop/common/branches/MR-279/mapreduce/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/JobImpl.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/MR-279/mapreduce/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/JobImpl.java?rev=1153759&r1=1153758&r2=1153759&view=diff
==============================================================================
--- hadoop/common/branches/MR-279/mapreduce/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/JobImpl.java
(original)
+++ hadoop/common/branches/MR-279/mapreduce/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/JobImpl.java
Thu Aug  4 05:59:29 2011
@@ -638,7 +638,7 @@ public class JobImpl implements org.apac
     try {
       if (TaskType.MAP == taskType) {
         tasksOfGivenType = mapTasks;
-      } else if (TaskType.REDUCE == taskType) {
+      } else {
         tasksOfGivenType = reduceTasks;
       }
       for (TaskId taskID : tasksOfGivenType)

Modified: hadoop/common/branches/MR-279/mapreduce/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/TaskAttemptImpl.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/MR-279/mapreduce/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/TaskAttemptImpl.java?rev=1153759&r1=1153758&r2=1153759&view=diff
==============================================================================
--- hadoop/common/branches/MR-279/mapreduce/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/TaskAttemptImpl.java
(original)
+++ hadoop/common/branches/MR-279/mapreduce/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/TaskAttemptImpl.java
Thu Aug  4 05:59:29 2011
@@ -520,6 +520,7 @@ public abstract class TaskAttemptImpl im
     }
   }
 
+
   /**
    * Create the {@link ContainerLaunchContext} for this attempt.
    */
@@ -576,7 +577,7 @@ public abstract class TaskAttemptImpl im
         // Add file-system tokens
         for (Token<? extends TokenIdentifier> token : fsTokens) {
           LOG.info("Putting fs-token for NM use for launching container : "
-              + token.getIdentifier().toString());
+              + token.toString());
           taskCredentials.addToken(token.getService(), token);
         }
       }
@@ -1417,10 +1418,10 @@ public abstract class TaskAttemptImpl im
   }
 
   private void initTaskAttemptStatus(TaskAttemptStatus result) {
-    result.progress = new Float(0);
-    result.diagnosticInfo = new String("");
+    result.progress = 0.0f;
+    result.diagnosticInfo = "";
     result.phase = Phase.STARTING;
-    result.stateString = new String("NEW");
+    result.stateString = "NEW";
     result.taskState = TaskAttemptState.NEW;
     Counters counters = recordFactory.newRecordInstance(Counters.class);
 //    counters.groups = new HashMap<String, CounterGroup>();

Modified: hadoop/common/branches/MR-279/mapreduce/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/rm/RMCommunicator.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/MR-279/mapreduce/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/rm/RMCommunicator.java?rev=1153759&r1=1153758&r2=1153759&view=diff
==============================================================================
--- hadoop/common/branches/MR-279/mapreduce/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/rm/RMCommunicator.java
(original)
+++ hadoop/common/branches/MR-279/mapreduce/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/rm/RMCommunicator.java
Thu Aug  4 05:59:29 2011
@@ -67,7 +67,7 @@ import org.apache.hadoop.yarn.service.Ab
  */
 public class RMCommunicator extends AbstractService  {
   private static final Log LOG = LogFactory.getLog(RMContainerAllocator.class);
-  private static int rmPollInterval;//millis
+  private int rmPollInterval;//millis
   protected ApplicationId applicationId;
   protected ApplicationAttemptId applicationAttemptId;
   private volatile boolean stopped;

Modified: hadoop/common/branches/MR-279/mapreduce/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/speculate/DataStatistics.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/MR-279/mapreduce/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/speculate/DataStatistics.java?rev=1153759&r1=1153758&r2=1153759&view=diff
==============================================================================
--- hadoop/common/branches/MR-279/mapreduce/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/speculate/DataStatistics.java
(original)
+++ hadoop/common/branches/MR-279/mapreduce/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/speculate/DataStatistics.java
Thu Aug  4 05:59:29 2011
@@ -45,8 +45,8 @@ public class DataStatistics {
 
   private synchronized void sub(double oldNum) {
     this.count--;
-    this.sum = Math.max(this.sum -= oldNum, 0.0d);
-    this.sumSquares = Math.max(this.sumSquares -= oldNum * oldNum, 0.0d);
+    this.sum = Math.max(this.sum - oldNum, 0.0d);
+    this.sumSquares = Math.max(this.sumSquares - oldNum * oldNum, 0.0d);
   }
 
   public synchronized double mean() {

Modified: hadoop/common/branches/MR-279/mapreduce/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/speculate/LegacyTaskRuntimeEstimator.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/MR-279/mapreduce/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/speculate/LegacyTaskRuntimeEstimator.java?rev=1153759&r1=1153758&r2=1153759&view=diff
==============================================================================
--- hadoop/common/branches/MR-279/mapreduce/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/speculate/LegacyTaskRuntimeEstimator.java
(original)
+++ hadoop/common/branches/MR-279/mapreduce/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/speculate/LegacyTaskRuntimeEstimator.java
Thu Aug  4 05:59:29 2011
@@ -85,10 +85,8 @@ public class LegacyTaskRuntimeEstimator 
           = attemptRuntimeEstimateVariances.get(taskAttempt);
 
       if (estimateContainer == null) {
-        synchronized (attemptRuntimeEstimates) {
-          if (attemptRuntimeEstimates.get(taskAttempt) == null) {
-            attemptRuntimeEstimates.put(taskAttempt, new AtomicLong());
-          }
+        if (attemptRuntimeEstimates.get(taskAttempt) == null) {
+          attemptRuntimeEstimates.put(taskAttempt, new AtomicLong());
 
           estimateContainer = attemptRuntimeEstimates.get(taskAttempt);
         }

Modified: hadoop/common/branches/MR-279/mapreduce/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/speculate/StartEndTimesBase.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/MR-279/mapreduce/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/speculate/StartEndTimesBase.java?rev=1153759&r1=1153758&r2=1153759&view=diff
==============================================================================
--- hadoop/common/branches/MR-279/mapreduce/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/speculate/StartEndTimesBase.java
(original)
+++ hadoop/common/branches/MR-279/mapreduce/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/speculate/StartEndTimesBase.java
Thu Aug  4 05:59:29 2011
@@ -87,8 +87,8 @@ abstract class StartEndTimesBase impleme
 
     Map<JobId, Job> allJobs = context.getAllJobs();
 
-    for (JobId jobID : allJobs.keySet()) {
-      final Job job = allJobs.get(jobID);
+    for (Map.Entry<JobId, Job> entry : allJobs.entrySet()) {
+      final Job job = entry.getValue();
       mapperStatistics.put(job, new DataStatistics());
       reducerStatistics.put(job, new DataStatistics());
       slowTaskRelativeTresholds.put

Modified: hadoop/common/branches/MR-279/mapreduce/mr-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/JobHistory.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/MR-279/mapreduce/mr-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/JobHistory.java?rev=1153759&r1=1153758&r2=1153759&view=diff
==============================================================================
--- hadoop/common/branches/MR-279/mapreduce/mr-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/JobHistory.java
(original)
+++ hadoop/common/branches/MR-279/mapreduce/mr-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/JobHistory.java
Thu Aug  4 05:59:29 2011
@@ -179,6 +179,11 @@ public class JobHistory extends Abstract
   public void init(Configuration conf) throws YarnException {
     LOG.info("JobHistory Init");
     this.conf = conf;
+    this.appID = RecordFactoryProvider.getRecordFactory(conf)
+        .newRecordInstance(ApplicationId.class);
+    this.appAttemptID = RecordFactoryProvider.getRecordFactory(conf)
+    .newRecordInstance(ApplicationAttemptId.class);
+
     debugMode = conf.getBoolean(JHConfig.HISTORY_DEBUG_MODE_KEY, false);
     serialNumberLowDigits = debugMode ? 1 : 3;
     serialNumberFormat = ("%0"
@@ -306,10 +311,6 @@ public class JobHistory extends Abstract
   
   public JobHistory() {
     super(JobHistory.class.getName());
-    this.appID = RecordFactoryProvider.getRecordFactory(conf)
-        .newRecordInstance(ApplicationId.class);
-    this.appAttemptID = RecordFactoryProvider.getRecordFactory(conf)
-    .newRecordInstance(ApplicationAttemptId.class);
   }
   
   /**
@@ -338,15 +339,14 @@ public class JobHistory extends Abstract
       LOG.warn("Could not find serial portion from path: " + serialDirPath.toString() + ".
Continuing with next");
       return;
     }
-    synchronized (idToDateString) {
-      if (idToDateString.containsKey(serialPart)) {
-        Set<String> set = idToDateString.get(serialPart);
-        set.remove(timeStampPart);
-        if (set.isEmpty()) {
-          idToDateString.remove(serialPart);
-        }
+    if (idToDateString.containsKey(serialPart)) {
+      Set<String> set = idToDateString.get(serialPart);
+      set.remove(timeStampPart);
+      if (set.isEmpty()) {
+        idToDateString.remove(serialPart);
       }
-  }
+    }
+
   }
   
   private void addDirectoryToSerialNumberIndex(Path serialDirPath) {
@@ -363,13 +363,11 @@ public class JobHistory extends Abstract
   }
 
   private void addToSerialNumberIndex(String serialPart, String timestampPart) {
-    synchronized (idToDateString) {
       if (!idToDateString.containsKey(serialPart)) {
         idToDateString.put(serialPart, new HashSet<String>());
         if (idToDateString.size() > dateStringCacheSize) {
           idToDateString.remove(idToDateString.firstKey());
         }
-      }
       Set<String> datePartSet = idToDateString.get(serialPart);
       datePartSet.add(timestampPart);
     }
@@ -435,11 +433,9 @@ public class JobHistory extends Abstract
    * Adds an entry to the loaded job cache. Maintains the size.
    */
   private void  addToLoadedJobCache(Job job) {
-    synchronized(loadedJobCache) {
-      loadedJobCache.put(job.getID(), job);
-      if (loadedJobCache.size() > loadedJobCacheSize ) {
-        loadedJobCache.remove(loadedJobCache.firstKey());
-      }
+    loadedJobCache.put(job.getID(), job);
+    if (loadedJobCache.size() > loadedJobCacheSize ) {
+      loadedJobCache.remove(loadedJobCache.firstKey());
     }
   }
   
@@ -705,10 +701,8 @@ public class JobHistory extends Abstract
   
   private Job findJob(JobId jobId) throws IOException {
     //Job already loaded.
-    synchronized (loadedJobCache) {
-      if (loadedJobCache.containsKey(jobId)) {
-        return loadedJobCache.get(jobId);
-      }
+    if (loadedJobCache.containsKey(jobId)) {
+      return loadedJobCache.get(jobId);        
     }
     
     //MetaInfo available in cache.
@@ -763,8 +757,9 @@ public class JobHistory extends Abstract
     Map<JobId, Job> resultMap = new TreeMap<JobId, Job>();
     
     SortedMap<JobId, JobIndexInfo> allJobs = getAllJobsMetaInfo();
-    for (JobId jobId : allJobs.keySet()) {
-      JobIndexInfo indexInfo = allJobs.get(jobId);
+    for (Map.Entry<JobId, JobIndexInfo> entry : allJobs.entrySet()) {
+      JobId jobId = entry.getKey();
+      JobIndexInfo indexInfo = entry.getValue();
       String jobName = indexInfo.getJobName();
       String jobUser = indexInfo.getUser();
       long finishTime = indexInfo.getFinishTime();
@@ -1123,7 +1118,7 @@ public class JobHistory extends Abstract
   
   
   //TODO AppContext - Not Required
-  private final ApplicationAttemptId appAttemptID;
+  private  ApplicationAttemptId appAttemptID;
   @Override
   public ApplicationAttemptId getApplicationAttemptId() {
   //TODO fixme - bogus appAttemptID for now
@@ -1131,7 +1126,7 @@ public class JobHistory extends Abstract
   }  
   
   //TODO AppContext - Not Required
-  private final ApplicationId appID;
+  private ApplicationId appID;
   @Override
   public ApplicationId getApplicationID() {
   //TODO fixme - bogus appID for now



Mime
View raw message