hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acmur...@apache.org
Subject svn commit: r588298 - in /lucene/hadoop/trunk: CHANGES.txt src/java/org/apache/hadoop/mapred/JobHistory.java src/webapps/job/jobconf.jsp
Date Thu, 25 Oct 2007 18:07:39 GMT
Author: acmurthy
Date: Thu Oct 25 11:07:39 2007
New Revision: 588298

URL: http://svn.apache.org/viewvc?rev=588298&view=rev
Log:
HADOOP-2096.  Close open file-descriptors held by streams while localizing job.xml in the
JobTracker and while displaying it on the webui in jobconf.jsp. Contributed by Amar Kamat.

Modified:
    lucene/hadoop/trunk/CHANGES.txt
    lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobHistory.java
    lucene/hadoop/trunk/src/webapps/job/jobconf.jsp

Modified: lucene/hadoop/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/CHANGES.txt?rev=588298&r1=588297&r2=588298&view=diff
==============================================================================
--- lucene/hadoop/trunk/CHANGES.txt (original)
+++ lucene/hadoop/trunk/CHANGES.txt Thu Oct 25 11:07:39 2007
@@ -41,6 +41,10 @@
     HADOOP-1642.  Ensure jobids generated by LocalJobRunner are unique to
     avoid collissions and hence job-failures. (Doug Cutting via acmurthy) 
 
+    HADOOP-2096.  Close open file-descriptors held by streams while localizing
+    job.xml in the JobTracker and while displaying it on the webui in 
+    jobconf.jsp. (Amar Kamat via acmurthy)
+
 Branch 0.15 (unreleased changes)
 
   INCOMPATIBLE CHANGES

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobHistory.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobHistory.java?rev=588298&r1=588297&r2=588298&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobHistory.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobHistory.java Thu Oct 25 11:07:39
2007
@@ -34,6 +34,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.util.StringUtils;
 /**
  * Provides methods for writing to and reading from job history. 
  * Job History works in an append mode, JobHistory and its inner classes provide methods

@@ -367,8 +368,9 @@
       /* Storing the job conf on the local file system */
       String localJobFilePath =  JobInfo.getLocalJobFilePath(jobId); 
       File localJobFile = new File(localJobFilePath);
+      FileOutputStream jobOut = null;
       try {
-        FileOutputStream jobOut = new FileOutputStream(localJobFile);
+        jobOut = new FileOutputStream(localJobFile);
         jobConf.write(jobOut);
         if (LOG.isDebugEnabled()) {
           LOG.debug("Job conf for " + jobId + " stored at " 
@@ -376,6 +378,15 @@
         }
       } catch (IOException ioe) {
         LOG.error("Failed to store job conf on the local filesystem ", ioe);
+      } finally {
+        if (jobOut != null) {
+          try {
+            jobOut.close();
+          } catch (IOException ie) {
+            LOG.info("Failed to close the job configuration file " 
+                     + StringUtils.stringifyException(ie));
+          }
+        }
       }
     }
     /**

Modified: lucene/hadoop/trunk/src/webapps/job/jobconf.jsp
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/webapps/job/jobconf.jsp?rev=588298&r1=588297&r2=588298&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/webapps/job/jobconf.jsp (original)
+++ lucene/hadoop/trunk/src/webapps/job/jobconf.jsp Thu Oct 25 11:07:39 2007
@@ -27,14 +27,22 @@
 
 <%
   String jobFilePath = tracker.getLocalJobFilePath(jobId);
+  FileInputStream jobFile = null;
   try {
+    jobFile = new FileInputStream(jobFilePath);
     JobConf jobConf = new JobConf(jobFilePath);
     XMLUtils.transform(
         jobConf.getConfResourceAsInputStream("webapps/static/jobconf.xsl"),
-        new FileInputStream(jobFilePath), out);
+        jobFile, out);
   } catch (Exception e) {
     out.println("Failed to retreive job configuration for job '" + jobId + "!");
     out.println(e);
+  } finally {
+    if (jobFile != null) {
+      try { 
+        jobFile.close(); 
+      } catch (IOException e) {}
+    }
   }
 %>
 



Mime
View raw message