Author: mc
Date: Tue Aug  2 23:19:09 2005
New Revision: 227173

URL: http://svn.apache.org/viewcvs?rev=227173&view=rev
Log:

  Fix synchronization bug with chasing down stray tasks



Modified:
    
lucene/nutch/branches/mapred/src/java/org/apache/nutch/mapred/TaskTracker.java

Modified: 
lucene/nutch/branches/mapred/src/java/org/apache/nutch/mapred/TaskTracker.java
URL: 
http://svn.apache.org/viewcvs/lucene/nutch/branches/mapred/src/java/org/apache/nutch/mapred/TaskTracker.java?rev=227173&r1=227172&r2=227173&view=diff
==============================================================================
--- 
lucene/nutch/branches/mapred/src/java/org/apache/nutch/mapred/TaskTracker.java 
(original)
+++ 
lucene/nutch/branches/mapred/src/java/org/apache/nutch/mapred/TaskTracker.java 
Tue Aug  2 23:19:09 2005
@@ -226,12 +226,14 @@
             //
             // Kill any tasks that have not reported progress in the last X 
seconds.
             //
-            for (Iterator it = runningTasks.values().iterator(); it.hasNext(); 
) {
-                TaskInProgress tip = (TaskInProgress) it.next();
-                if ((tip.getRunState() == TaskStatus.RUNNING) &&
-                    (System.currentTimeMillis() - tip.getLastProgressReport() 
> TASK_MIN_PROGRESS_INTERVAL)) {
-                    LOG.info("Task " + tip.getTask().getTaskId() + " has not 
reported progress for a long time.  Killing...");
-                    tip.cleanup();
+            synchronized (runningTasks) {
+                for (Iterator it = runningTasks.values().iterator(); 
it.hasNext(); ) {
+                    TaskInProgress tip = (TaskInProgress) it.next();
+                    if ((tip.getRunState() == TaskStatus.RUNNING) &&
+                        (System.currentTimeMillis() - 
tip.getLastProgressReport() > TASK_MIN_PROGRESS_INTERVAL)) {
+                        LOG.info("Task " + tip.getTask().getTaskId() + " has 
not reported progress for a long time.  Killing...");
+                        tip.cleanup();
+                    }
                 }
             }
 


Reply via email to