Reorganize job reset thread to be sure that doc reprioritization is actually done
git-svn-id: https://svn.apache.org/repos/asf/manifoldcf/branches/CONNECTORS-1119@1647562 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/JobResetThread.java b/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/JobResetThread.java
index 80fefca..bf77ae8 100644
--- a/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/JobResetThread.java
+++ b/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/JobResetThread.java
@@ -70,40 +70,10 @@
ArrayList jobStops = new ArrayList();
jobManager.finishJobStops(currentTime,jobStops);
- int k = 0;
- while (k < jobStops.size())
- {
- IJobDescription desc = (IJobDescription)jobStops.get(k++);
- connectionManager.recordHistory(desc.getConnectionName(),
- null,connectionManager.ACTIVITY_JOBSTOP,null,
- desc.getID().toString()+"("+desc.getDescription()+")",null,null,null);
- // As a courtesy, call all the notification connections (if any)
- doStopNotifications(desc,notificationManager,notificationPool);
- }
-
ArrayList jobResumes = new ArrayList();
jobManager.finishJobResumes(currentTime,jobResumes);
- k = 0;
- while (k < jobResumes.size())
- {
- IJobDescription desc = (IJobDescription)jobResumes.get(k++);
- connectionManager.recordHistory(desc.getConnectionName(),
- null,connectionManager.ACTIVITY_JOBCONTINUE,null,
- desc.getID().toString()+"("+desc.getDescription()+")",null,null,null);
- }
-
ArrayList jobCompletions = new ArrayList();
jobManager.resetJobs(currentTime,jobCompletions);
- k = 0;
- while (k < jobCompletions.size())
- {
- IJobDescription desc = (IJobDescription)jobCompletions.get(k++);
- connectionManager.recordHistory(desc.getConnectionName(),
- null,connectionManager.ACTIVITY_JOBEND,null,
- desc.getID().toString()+"("+desc.getDescription()+")",null,null,null);
- // As a courtesy, call all the notification connections (if any)
- doEndNotifications(desc,notificationManager,notificationPool);
- }
// If there were any job aborts, we must reprioritize all active documents, since we've done something
// not predicted by the algorithm that assigned those priorities. This is, of course, quite expensive,
@@ -118,8 +88,39 @@
Logging.threads.debug("Job reset thread done reprioritizing documents.");
}
- else
- ManifoldCF.sleep(10000L);
+
+ int k = 0;
+ while (k < jobStops.size())
+ {
+ IJobDescription desc = (IJobDescription)jobStops.get(k++);
+ connectionManager.recordHistory(desc.getConnectionName(),
+ null,connectionManager.ACTIVITY_JOBSTOP,null,
+ desc.getID().toString()+"("+desc.getDescription()+")",null,null,null);
+ // As a courtesy, call all the notification connections (if any)
+ doStopNotifications(desc,notificationManager,notificationPool);
+ }
+
+ k = 0;
+ while (k < jobResumes.size())
+ {
+ IJobDescription desc = (IJobDescription)jobResumes.get(k++);
+ connectionManager.recordHistory(desc.getConnectionName(),
+ null,connectionManager.ACTIVITY_JOBCONTINUE,null,
+ desc.getID().toString()+"("+desc.getDescription()+")",null,null,null);
+ }
+
+ k = 0;
+ while (k < jobCompletions.size())
+ {
+ IJobDescription desc = (IJobDescription)jobCompletions.get(k++);
+ connectionManager.recordHistory(desc.getConnectionName(),
+ null,connectionManager.ACTIVITY_JOBEND,null,
+ desc.getID().toString()+"("+desc.getDescription()+")",null,null,null);
+ // As a courtesy, call all the notification connections (if any)
+ doEndNotifications(desc,notificationManager,notificationPool);
+ }
+
+ ManifoldCF.sleep(10000L);
}
catch (ManifoldCFException e)
{