manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1837090 - /manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobManager.java
Date Mon, 30 Jul 2018 20:31:26 GMT
Author: kwright
Date: Mon Jul 30 20:31:25 2018
New Revision: 1837090

URL: http://svn.apache.org/viewvc?rev=1837090&view=rev
Log:
Second fix for CONNECTORS-1520

Modified:
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobManager.java

Modified: manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobManager.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobManager.java?rev=1837090&r1=1837089&r2=1837090&view=diff
==============================================================================
--- manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobManager.java
(original)
+++ manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobManager.java
Mon Jul 30 20:31:25 2018
@@ -455,6 +455,30 @@ public class JobManager implements IJobM
     if (jobIDs.length == 0)
       return;
 
+    int maxCount = database.findConjunctionClauseMax(new ClauseDescription[]{});
+    int currentCount = 0;
+    List<Long> newList = new ArrayList<>();
+    int i = 0;
+    while (i < jobIDs.length)
+    {
+      if (currentCount == maxCount)
+      {
+        noteNotificationJobDeregistration(newList);
+        newList.clear();
+        currentCount = 0;
+      }
+
+      newList.add(jobIDs[i++]);
+      currentCount++;
+    }
+    if (currentCount > 0)
+      noteNotificationJobDeregistration(newList);
+  }
+  
+  protected void noteNotificationJobDeregistration(List<Long> jobIDs)
+    throws ManifoldCFException
+  {
+
     StringBuilder query = new StringBuilder();
     ArrayList newList = new ArrayList();
     
@@ -514,6 +538,30 @@ public class JobManager implements IJobM
     if (jobIDs.length == 0)
       return;
 
+    int maxCount = database.findConjunctionClauseMax(new ClauseDescription[]{});
+    int currentCount = 0;
+    List<Long> newList = new ArrayList<>();
+    int i = 0;
+    while (i < jobIDs.length)
+    {
+      if (currentCount == maxCount)
+      {
+        noteNotificationJobRegistration(newList);
+        newList.clear();
+        currentCount = 0;
+      }
+
+      newList.add(jobIDs[i++]);
+      currentCount++;
+    }
+    if (currentCount > 0)
+      noteNotificationJobRegistration(newList);
+  }
+  
+  protected void noteNotificationJobRegistration(List<Long> jobIDs)
+    throws ManifoldCFException
+  {
+
     StringBuilder query = new StringBuilder();
     ArrayList newList = new ArrayList();
     
@@ -573,6 +621,30 @@ public class JobManager implements IJobM
     if (jobIDs.length == 0)
       return;
 
+    int maxCount = database.findConjunctionClauseMax(new ClauseDescription[]{});
+    int currentCount = 0;
+    List<Long> newList = new ArrayList<>();
+    int i = 0;
+    while (i < jobIDs.length)
+    {
+      if (currentCount == maxCount)
+      {
+        noteOutputJobDeregistration(newList);
+        newList.clear();
+        currentCount = 0;
+      }
+
+      newList.add(jobIDs[i++]);
+      currentCount++;
+    }
+    if (currentCount > 0)
+      noteOutputJobDeregistration(newList);
+  }
+  
+  protected void noteOutputJobDeregistration(List<Long> jobIDs)
+    throws ManifoldCFException
+  {
+
     StringBuilder query = new StringBuilder();
     ArrayList newList = new ArrayList();
     
@@ -632,6 +704,30 @@ public class JobManager implements IJobM
     if (jobIDs.length == 0)
       return;
 
+    int maxCount = database.findConjunctionClauseMax(new ClauseDescription[]{});
+    int currentCount = 0;
+    List<Long> newList = new ArrayList<>();
+    int i = 0;
+    while (i < jobIDs.length)
+    {
+      if (currentCount == maxCount)
+      {
+        noteOutputJobRegistration(newList);
+        newList.clear();
+        currentCount = 0;
+      }
+
+      newList.add(jobIDs[i++]);
+      currentCount++;
+    }
+    if (currentCount > 0)
+      noteOutputJobRegistration(newList);
+  }
+  
+  protected void noteOutputJobRegistration(List<Long> jobIDs)
+    throws ManifoldCFException
+  {
+
     StringBuilder query = new StringBuilder();
     ArrayList newList = new ArrayList();
     
@@ -691,6 +787,29 @@ public class JobManager implements IJobM
     if (jobIDs.length == 0)
       return;
 
+    int maxCount = database.findConjunctionClauseMax(new ClauseDescription[]{});
+    int currentCount = 0;
+    List<Long> newList = new ArrayList<>();
+    int i = 0;
+    while (i < jobIDs.length)
+    {
+      if (currentCount == maxCount)
+      {
+        noteTransformationJobDeregistration(newList);
+        newList.clear();
+        currentCount = 0;
+      }
+
+      newList.add(jobIDs[i++]);
+      currentCount++;
+    }
+    if (currentCount > 0)
+      noteTransformationJobDeregistration(newList);
+  }
+  
+  protected void noteTransformationJobDeregistration(List<Long> jobIDs)
+    throws ManifoldCFException
+  {
     StringBuilder query = new StringBuilder();
     ArrayList newList = new ArrayList();
     
@@ -750,6 +869,30 @@ public class JobManager implements IJobM
     if (jobIDs.length == 0)
       return;
 
+    int maxCount = database.findConjunctionClauseMax(new ClauseDescription[]{});
+    int currentCount = 0;
+    List<Long> newList = new ArrayList<>();
+    int i = 0;
+    while (i < jobIDs.length)
+    {
+      if (currentCount == maxCount)
+      {
+        noteTransformationJobRegistration(newList);
+        newList.clear();
+        currentCount = 0;
+      }
+
+      newList.add(jobIDs[i++]);
+      currentCount++;
+    }
+    if (currentCount > 0)
+      noteTransformationJobRegistration(newList);
+  }
+  
+  protected void noteTransformationJobRegistration(List<Long> jobIDs)
+    throws ManifoldCFException
+  {
+
     StringBuilder query = new StringBuilder();
     ArrayList newList = new ArrayList();
     



Mime
View raw message