You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nutch.apache.org by mc...@apache.org on 2005/08/03 08:19:10 UTC

svn commit: r227173 - /lucene/nutch/branches/mapred/src/java/org/apache/nutch/mapred/TaskTracker.java

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();
+                    }
                 }
             }