hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tomwh...@apache.org
Subject svn commit: r529227 - in /lucene/hadoop/trunk: CHANGES.txt src/java/org/apache/hadoop/mapred/jobcontrol/Job.java src/java/org/apache/hadoop/mapred/jobcontrol/JobControl.java
Date Mon, 16 Apr 2007 12:59:44 GMT
Author: tomwhite
Date: Mon Apr 16 05:59:43 2007
New Revision: 529227

URL: http://svn.apache.org/viewvc?view=rev&rev=529227
Log:
HADOOP-1253.  Fix ConcurrentModificationException and NullPointerException in JobControl.
 Contributed by Johan Oskarson.

Modified:
    lucene/hadoop/trunk/CHANGES.txt
    lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/jobcontrol/Job.java
    lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/jobcontrol/JobControl.java

Modified: lucene/hadoop/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/CHANGES.txt?view=diff&rev=529227&r1=529226&r2=529227
==============================================================================
--- lucene/hadoop/trunk/CHANGES.txt (original)
+++ lucene/hadoop/trunk/CHANGES.txt Mon Apr 16 05:59:43 2007
@@ -194,6 +194,10 @@
     slaves file for stopping datanode.  
     (Michael Bieniosek via tomwhite)
 
+59. HADOOP-1253.  Fix ConcurrentModificationException and 
+    NullPointerException in JobControl.  
+    (Johan Oskarson via tomwhite)
+
 
 Release 0.12.3 - 2007-04-06
 

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/jobcontrol/Job.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/jobcontrol/Job.java?view=diff&rev=529227&r1=529226&r2=529227
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/jobcontrol/Job.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/jobcontrol/Job.java Mon Apr 16 05:59:43
2007
@@ -243,7 +243,8 @@
 			this.state = Job.FAILED;
 			this.message = StringUtils.stringifyException(ioe);
 			try {
-				running.killJob();
+				if(running != null)
+					running.killJob();
 			} catch (IOException e1) {
 
 			}

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/jobcontrol/JobControl.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/jobcontrol/JobControl.java?view=diff&rev=529227&r1=529226&r2=529227
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/jobcontrol/JobControl.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/jobcontrol/JobControl.java Mon Apr
16 05:59:43 2007
@@ -19,6 +19,7 @@
 package org.apache.hadoop.mapred.jobcontrol;
 
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Hashtable;
 import java.util.Iterator;
 
@@ -74,10 +75,13 @@
 	
 	private static ArrayList toArrayList(Hashtable jobs) {
 		ArrayList retv = new ArrayList();
-		Iterator iter = jobs.values().iterator();
-		while (iter.hasNext()) {
-			retv.add(iter.next());
+		synchronized (jobs) {
+			Iterator iter = jobs.values().iterator();
+			while (iter.hasNext()) {
+				retv.add(iter.next());
+			}
 		}
+		
 		return retv;
 	}
 	
@@ -159,13 +163,16 @@
 	}
 	
 	/**
-	 * @param args
-	 */
-	public static void main(String[] args) {
-		// TODO Auto-generated method stub
-
+	 * Add a collection of jobs
+	 * 
+	 * @param jobs
+	 */
+	public void addJobs(Collection<Job> jobs) {
+		for (Job job : jobs) {
+			addJob(job);
+		}
 	}
-
+	
 	/**
 	 * @return the thread state
 	 */



Mime
View raw message