You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@manifoldcf.apache.org by kw...@apache.org on 2014/12/21 21:34:11 UTC

svn commit: r1647208 - /manifoldcf/branches/CONNECTORS-1119/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/JobNotificationThread.java

Author: kwright
Date: Sun Dec 21 20:34:10 2014
New Revision: 1647208

URL: http://svn.apache.org/r1647208
Log:
Clean up job notification thread a bit

Modified:
    manifoldcf/branches/CONNECTORS-1119/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/JobNotificationThread.java

Modified: manifoldcf/branches/CONNECTORS-1119/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/JobNotificationThread.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1119/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/JobNotificationThread.java?rev=1647208&r1=1647207&r2=1647208&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1119/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/JobNotificationThread.java (original)
+++ manifoldcf/branches/CONNECTORS-1119/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/JobNotificationThread.java Sun Dec 21 20:34:10 2014
@@ -72,15 +72,14 @@ public class JobNotificationThread exten
           // Before we begin, conditionally reset
           resetManager.waitForReset(threadContext);
 
+          // Find the jobs ready for inactivity and notify them
           JobNotifyRecord[] jobsNeedingNotification = jobManager.getJobsReadyForInactivity(processID);
           try
           {
             Set<OutputAndRepositoryConnection> connectionNames = new HashSet<OutputAndRepositoryConnection>();
             
-            int k = 0;
-            while (k < jobsNeedingNotification.length)
+            for (JobNotifyRecord jsr : jobsNeedingNotification)
             {
-              JobNotifyRecord jsr = jobsNeedingNotification[k++];
               Long jobID = jsr.getJobID();
               IJobDescription job = jobManager.load(jobID,true);
               if (job != null)
@@ -147,10 +146,8 @@ public class JobNotificationThread exten
             }
             
             // Go through jobs again, and put the notified ones into the inactive state.
-            k = 0;
-            while (k < jobsNeedingNotification.length)
+            for (JobNotifyRecord jsr : jobsNeedingNotification)
             {
-              JobNotifyRecord jsr = jobsNeedingNotification[k++];
               Long jobID = jsr.getJobID();
               IJobDescription job = jobManager.load(jobID,true);
               if (job != null)
@@ -249,16 +246,14 @@ public class JobNotificationThread exten
               throw exception;
           }
 
-          // ???
+          // We also need to do a notify for jobs that are about to be deleted
           JobNotifyRecord[] jobsNeedingDeleteNotification = jobManager.getJobsReadyForDelete(processID);
           try
           {
             Set<OutputAndRepositoryConnection> connectionNames = new HashSet<OutputAndRepositoryConnection>();
             
-            int k = 0;
-            while (k < jobsNeedingDeleteNotification.length)
+            for (JobNotifyRecord jsr : jobsNeedingDeleteNotification)
             {
-              JobNotifyRecord jsr = jobsNeedingDeleteNotification[k++];
               Long jobID = jsr.getJobID();
               IJobDescription job = jobManager.load(jobID,true);
               if (job != null)
@@ -325,10 +320,8 @@ public class JobNotificationThread exten
             }
             
             // Go through jobs again, and put the notified ones into the inactive state.
-            k = 0;
-            while (k < jobsNeedingDeleteNotification.length)
+            for (JobNotifyRecord jsr : jobsNeedingDeleteNotification)
             {
-              JobNotifyRecord jsr = jobsNeedingDeleteNotification[k++];
               Long jobID = jsr.getJobID();
               IJobDescription job = jobManager.load(jobID,true);
               if (job != null)