Author: kwright
Date: Mon Oct 7 00:30:19 2013
New Revision: 1529723
URL: http://svn.apache.org/r1529723
Log:
Hook up limit count for jobstatus requests. Part of CONNECTORS-783.
Modified:
manifoldcf/trunk/framework/crawler-ui/src/main/webapp/showjobstatus.jsp
manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/interfaces/IJobManager.java
manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/interfaces/JobStatus.java
manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobManager.java
Modified:
manifoldcf/trunk/framework/crawler-ui/src/main/webapp/showjobstatus.jsp
URL:
http://svn.apache.org/viewvc/manifoldcf/trunk/framework/crawler-ui/src/main/webapp/showjobstatus.jsp?rev=1529723&r1=1529722&r2=1529723&view=diff
==============================================================================
--- manifoldcf/trunk/framework/crawler-ui/src/main/webapp/showjobstatus.jsp
(original)
+++ manifoldcf/trunk/framework/crawler-ui/src/main/webapp/showjobstatus.jsp Mon
Oct 7 00:30:19 2013
@@ -251,9 +251,9 @@ if (maintenanceUnderway == false)
%>
</td>
<td
class="columncell"><%="<!--jobid="+js.getJobID()+"-->"%><%=js.getDescription()%></td><td
class="columncell"><%=statusName%></td><td
class="columncell"><%=startTime%></td><td class="columncell"><%=endTime%></td>
- <td class="columncell"><%=new
Long(js.getDocumentsInQueue()).toString()%></td>
- <td class="columncell"><%=new
Long(js.getDocumentsOutstanding()).toString()%></td>
- <td class="columncell"><%=new
Long(js.getDocumentsProcessed()).toString()%></td>
+ <td
class="columncell"><%(js.getQueueCountExact()?"":"~")%><%=new
Long(js.getDocumentsInQueue()).toString()%></td>
+ <td
class="columncell"><%(js.getOutstandingCountExact()?"":"~")%><%=new
Long(js.getDocumentsOutstanding()).toString()%></td>
+ <td
class="columncell"><%(js.getProcessedCountExact()?"":"~")%><%=new
Long(js.getDocumentsProcessed()).toString()%></td>
</tr>
<%
}
Modified:
manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/interfaces/IJobManager.java
URL:
http://svn.apache.org/viewvc/manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/interfaces/IJobManager.java?rev=1529723&r1=1529722&r2=1529723&view=diff
==============================================================================
---
manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/interfaces/IJobManager.java
(original)
+++
manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/interfaces/IJobManager.java
Mon Oct 7 00:30:19 2013
@@ -973,6 +973,7 @@ public interface IJobManager
// Status reports
/** Get the status of a job.
+ *@param jobID is the job ID.
*@return the status object for the specified job.
*/
public JobStatus getStatus(Long jobID)
@@ -997,6 +998,7 @@ public interface IJobManager
throws ManifoldCFException;
/** Get the status of a job.
+ *@param jobID is the job ID.
*@param includeCounts is true if document counts should be included.
*@return the status object for the specified job.
*/
@@ -1024,6 +1026,39 @@ public interface IJobManager
public JobStatus[] getFinishedJobs(boolean includeCounts)
throws ManifoldCFException;
+ /** Get the status of a job.
+ *@param jobID is the job ID.
+ *@param includeCounts is true if document counts should be included.
+ *@param maxCount is the maximum number of documents we want to count for
each status.
+ *@return the status object for the specified job.
+ */
+ public JobStatus getStatus(Long jobID, boolean includeCounts, int maxCount)
+ throws ManifoldCFException;
+
+ /** Get a list of all jobs, and their status information.
+ *@param includeCounts is true if document counts should be included.
+ *@param maxCount is the maximum number of documents we want to count for
each status.
+ *@return an ordered array of job status objects.
+ */
+ public JobStatus[] getAllStatus(boolean includeCounts, int maxCount)
+ throws ManifoldCFException;
+
+ /** Get a list of running jobs. This is for status reporting.
+ *@param includeCounts is true if document counts should be included.
+ *@param maxCount is the maximum number of documents we want to count for
each status.
+ *@return an array of the job status objects.
+ */
+ public JobStatus[] getRunningJobs(boolean includeCounts, int maxCount)
+ throws ManifoldCFException;
+
+ /** Get a list of completed jobs, and their statistics.
+ *@param includeCounts is true if document counts should be included.
+ *@param maxCount is the maximum number of documents we want to count for
each status.
+ *@return an array of the job status objects.
+ */
+ public JobStatus[] getFinishedJobs(boolean includeCounts, int maxCount)
+ throws ManifoldCFException;
+
// The following commands generate reports based on the queue.
/** Run a 'document status' report.
Modified:
manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/interfaces/JobStatus.java
URL:
http://svn.apache.org/viewvc/manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/interfaces/JobStatus.java?rev=1529723&r1=1529722&r2=1529723&view=diff
==============================================================================
---
manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/interfaces/JobStatus.java
(original)
+++
manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/interfaces/JobStatus.java
Mon Oct 7 00:30:19 2013
@@ -44,15 +44,18 @@ public class JobStatus
// Member variables.
- protected String jobID;
- protected String description;
- protected int status;
- protected long documentsInQueue;
- protected long documentsOutstanding;
- protected long documentsProcessed;
- protected long startTime; // -1 if job never started
- protected long endTime; // -1 if job has not ended yet
- protected String errorText; // null if no error on previous action
+ protected final String jobID;
+ protected final String description;
+ protected final int status;
+ protected final long documentsInQueue;
+ protected final long documentsOutstanding;
+ protected final long documentsProcessed;
+ protected final boolean queueCountExact;
+ protected final boolean outstandingCountExact;
+ protected final boolean processedCountExact;
+ protected final long startTime; // -1 if job never started
+ protected final long endTime; // -1 if job has not ended yet
+ protected final String errorText; // null if no error on previous action
/** Constructor.
*@param jobID is the job identifier.
@@ -70,6 +73,9 @@ public class JobStatus
long documentsInQueue,
long documentsOutstanding,
long documentsProcessed,
+ boolean queueCountExact,
+ boolean outstandingCountExact,
+ boolean processedCountExact,
long startTime,
long endTime,
String errorText)
@@ -80,6 +86,9 @@ public class JobStatus
this.documentsInQueue = documentsInQueue;
this.documentsOutstanding = documentsOutstanding;
this.documentsProcessed = documentsProcessed;
+ this.queueCountExact = queueCountExact;
+ this.outstandingCountExact = outstandingCountExact;
+ this.processedCountExact = processedCountExact;
this.startTime = startTime;
this.endTime = endTime;
this.errorText = errorText;
@@ -117,6 +126,14 @@ public class JobStatus
return documentsInQueue;
}
+ /** Get whether the queue count is accurate, or an estimate.
+ *@return true if accurate.
+ */
+ public boolean getQueueCountExact()
+ {
+ return queueCountExact;
+ }
+
/** Get the number of documents outstanding.
*@return the documents that are waiting for processing.
*/
@@ -125,6 +142,14 @@ public class JobStatus
return documentsOutstanding;
}
+ /** Get whether the outstanding count is accurate, or an estimate.
+ *@return true if accurate.
+ */
+ public boolean getOutstandingCountExact()
+ {
+ return outstandingCountExact;
+ }
+
/** Get the number of documents that have been processed at least once.
*@return the document count.
*/
@@ -133,6 +158,14 @@ public class JobStatus
return documentsProcessed;
}
+ /** Get whether the processed count is accurate, or an estimate.
+ *@return true if accurate.
+ */
+ public boolean getProcessedCountExact()
+ {
+ return processedCountExact;
+ }
+
/** Get the start time.
*@return the start time, or -1
*/
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=1529723&r1=1529722&r2=1529723&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 Oct 7 00:30:19 2013
@@ -7064,6 +7064,7 @@ public class JobManager implements IJobM
/** Get the status of a job.
*@return the status object for the specified job.
*/
+ @Override
public JobStatus getStatus(Long jobID)
throws ManifoldCFException
{
@@ -7073,6 +7074,7 @@ public class JobManager implements IJobM
/** Get a list of all jobs, and their status information.
*@return an ordered array of job status objects.
*/
+ @Override
public JobStatus[] getAllStatus()
throws ManifoldCFException
{
@@ -7082,6 +7084,7 @@ public class JobManager implements IJobM
/** Get a list of running jobs. This is for status reporting.
*@return an array of the job status objects.
*/
+ @Override
public JobStatus[] getRunningJobs()
throws ManifoldCFException
{
@@ -7091,6 +7094,7 @@ public class JobManager implements IJobM
/** Get a list of completed jobs, and their statistics.
*@return an array of the job status objects.
*/
+ @Override
public JobStatus[] getFinishedJobs()
throws ManifoldCFException
{
@@ -7098,16 +7102,58 @@ public class JobManager implements IJobM
}
/** Get the status of a job.
+ *@param jobID is the job ID.
*@param includeCounts is true if document counts should be included.
*@return the status object for the specified job.
*/
public JobStatus getStatus(Long jobID, boolean includeCounts)
throws ManifoldCFException
{
+ return getStatus(jobID, includeCounts, Integer.MAX_VALUE);
+ }
+
+ /** Get a list of all jobs, and their status information.
+ *@param includeCounts is true if document counts should be included.
+ *@return an ordered array of job status objects.
+ */
+ public JobStatus[] getAllStatus(boolean includeCounts)
+ throws ManifoldCFException
+ {
+ return getAllStatus(includeCounts, Integer.MAX_VALUE);
+ }
+
+ /** Get a list of running jobs. This is for status reporting.
+ *@param includeCounts is true if document counts should be included.
+ *@return an array of the job status objects.
+ */
+ public JobStatus[] getRunningJobs(boolean includeCounts)
+ throws ManifoldCFException
+ {
+ return getRunningJobs(includeCounts, Integer.MAX_VALUE);
+ }
+
+ /** Get a list of completed jobs, and their statistics.
+ *@param includeCounts is true if document counts should be included.
+ *@return an array of the job status objects.
+ */
+ public JobStatus[] getFinishedJobs(boolean includeCounts)
+ throws ManifoldCFException
+ {
+ return getFinishedJobs(includeCounts, Integer.MAX_VALUE);
+ }
+
+ /** Get the status of a job.
+ *@param includeCounts is true if document counts should be included.
+ *@return the status object for the specified job.
+ */
+ @Override
+ public JobStatus getStatus(Long jobID, boolean includeCounts, int maxCount)
+ throws ManifoldCFException
+ {
ArrayList list = new ArrayList();
String whereClause = Jobs.idField+"=?";
list.add(jobID);
- JobStatus[] records = makeJobStatus(whereClause,list,includeCounts);
+ JobStatus[] records =
makeJobStatus(whereClause,list,includeCounts,maxCount);
if (records.length == 0)
return null;
return records[0];
@@ -7116,19 +7162,22 @@ public class JobManager implements IJobM
/** Get a list of all jobs, and their status information.
*@param includeCounts is true if document counts should be included.
+ *@param maxCount is the maximum number of documents we want to count for
each status.
*@return an ordered array of job status objects.
*/
- public JobStatus[] getAllStatus(boolean includeCounts)
+ public JobStatus[] getAllStatus(boolean includeCounts, int maxCount)
throws ManifoldCFException
{
- return makeJobStatus(null,null,includeCounts);
+ return makeJobStatus(null,null,includeCounts,maxCount);
}
/** Get a list of running jobs. This is for status reporting.
*@param includeCounts is true if document counts should be included.
+ *@param maxCount is the maximum number of documents we want to count for
each status.
*@return an array of the job status objects.
*/
- public JobStatus[] getRunningJobs(boolean includeCounts)
+ @Override
+ public JobStatus[] getRunningJobs(boolean includeCounts, int maxCount)
throws ManifoldCFException
{
ArrayList whereParams = new ArrayList();
@@ -7159,14 +7208,16 @@ public class JobManager implements IJobM
Jobs.statusToString(Jobs.STATUS_RESUMINGSEEDING)
})});
- return makeJobStatus(whereClause,whereParams,includeCounts);
+ return makeJobStatus(whereClause,whereParams,includeCounts,maxCount);
}
/** Get a list of completed jobs, and their statistics.
*@param includeCounts is true if document counts should be included.
+ *@param maxCount is the maximum number of documents we want to count for
each status.
*@return an array of the job status objects.
*/
- public JobStatus[] getFinishedJobs(boolean includeCounts)
+ @Override
+ public JobStatus[] getFinishedJobs(boolean includeCounts, int maxCount)
throws ManifoldCFException
{
StringBuilder sb = new StringBuilder();
@@ -7176,7 +7227,7 @@ public class JobManager implements IJobM
new
UnitaryClause(Jobs.statusField,Jobs.statusToString(Jobs.STATUS_INACTIVE))})).append("
AND ")
.append(Jobs.endTimeField).append(" IS NOT NULL");
- return makeJobStatus(sb.toString(),whereParams,includeCounts);
+ return makeJobStatus(sb.toString(),whereParams,includeCounts,maxCount);
}
// Protected methods and classes
@@ -7185,7 +7236,7 @@ public class JobManager implements IJobM
*@param whereClause is the where clause for the jobs we are interested in.
*@return the status array.
*/
- protected JobStatus[] makeJobStatus(String whereClause, ArrayList
whereParams, boolean includeCounts)
+ protected JobStatus[] makeJobStatus(String whereClause, ArrayList
whereParams, boolean includeCounts, int maxCount)
throws ManifoldCFException
{
IResultSet set = database.performQuery("SELECT t0."+
@@ -7198,130 +7249,131 @@ public class JobManager implements IJobM
" FROM "+jobs.getTableName()+" t0 "+((whereClause==null)?"":(" WHERE
"+whereClause))+" ORDER BY "+Jobs.descriptionField+" ASC",
whereParams,null,null);
- IResultSet set2 = null;
- IResultSet set3 = null;
- IResultSet set4 = null;
+ // Build hashes for set2 and set3
+ Map<Long,Long> set2Hash = new HashMap<Long,Long>();
+ Map<Long,Long> set3Hash = new HashMap<Long,Long>();
+ Map<Long,Long> set4Hash = new HashMap<Long,Long>();
+ Map<Long,Boolean> set2Exact = new HashMap<Long,Boolean>();
+ Map<Long,Boolean> set3Exact = new HashMap<Long,Boolean>();
+ Map<Long,Boolean> set4Exact = new HashMap<Long,Boolean>();
if (includeCounts)
{
- StringBuilder sb = new StringBuilder("SELECT ");
- ArrayList list = new ArrayList();
-
- sb.append(JobQueue.jobIDField).append(",")
- .append(database.constructCountClause(JobQueue.docHashField)).append("
AS doccount")
- .append(" FROM ").append(jobQueue.getTableName()).append(" t1");
-
- if (whereClause != null)
- {
- sb.append(" WHERE EXISTS(SELECT 'x' FROM
").append(jobs.getTableName()).append(" t0 WHERE ")
- .append(database.buildConjunctionClause(list,new ClauseDescription[]{
- new
JoinClause("t0."+Jobs.idField,"t1."+JobQueue.jobIDField)})).append(" AND ")
- .append(whereClause)
- .append(")");
- list.addAll(whereParams);
- }
-
- sb.append(" GROUP BY ").append(JobQueue.jobIDField);
-
- set2 = database.performQuery(sb.toString(),list,null,null);
-
- sb = new StringBuilder("SELECT ");
- list.clear();
-
- sb.append(JobQueue.jobIDField).append(",")
- .append(database.constructCountClause(JobQueue.docHashField)).append("
AS doccount")
- .append(" FROM ").append(jobQueue.getTableName()).append(" t1 WHERE ")
- .append(database.buildConjunctionClause(list,new ClauseDescription[]{
- new MultiClause(JobQueue.statusField,new Object[]{
- JobQueue.statusToString(JobQueue.STATUS_ACTIVE),
- JobQueue.statusToString(JobQueue.STATUS_ACTIVENEEDRESCAN),
- JobQueue.statusToString(JobQueue.STATUS_PENDING),
- JobQueue.statusToString(JobQueue.STATUS_ACTIVEPURGATORY),
- JobQueue.statusToString(JobQueue.STATUS_ACTIVENEEDRESCANPURGATORY),
- JobQueue.statusToString(JobQueue.STATUS_PENDINGPURGATORY)})}));
- if (whereClause != null)
- {
- sb.append(" AND EXISTS(SELECT 'x' FROM
").append(jobs.getTableName()).append(" t0 WHERE ")
- .append(database.buildConjunctionClause(list,new ClauseDescription[]{
- new
JoinClause("t0."+Jobs.idField,"t1."+JobQueue.jobIDField)})).append(" AND ")
- .append(whereClause)
- .append(")");
- if (whereParams != null)
+ // If we are counting all of them anyway, do this via GROUP BY since it
will be the fastest. But
+ // otherwise, fire off an individual query at a time.
+ if (maxCount == Integer.MAX_VALUE)
+ {
+ StringBuilder sb = new StringBuilder("SELECT ");
+ ArrayList list = new ArrayList();
+
+ sb.append(JobQueue.jobIDField).append(",")
+
.append(database.constructCountClause(JobQueue.docHashField)).append(" AS
doccount")
+ .append(" FROM ").append(jobQueue.getTableName()).append(" t1");
+
+ if (whereClause != null)
+ {
+ sb.append(" WHERE EXISTS(SELECT 'x' FROM
").append(jobs.getTableName()).append(" t0 WHERE ")
+ .append(database.buildConjunctionClause(list,new
ClauseDescription[]{
+ new
JoinClause("t0."+Jobs.idField,"t1."+JobQueue.jobIDField)})).append(" AND ")
+ .append(whereClause)
+ .append(")");
list.addAll(whereParams);
- }
- sb.append(" GROUP BY ").append(JobQueue.jobIDField);
-
- set3 = database.performQuery(sb.toString(),list,null,null);
-
- sb = new StringBuilder("SELECT ");
- list.clear();
-
- sb.append(JobQueue.jobIDField).append(",")
- .append(database.constructCountClause(JobQueue.docHashField)).append("
AS doccount")
- .append(" FROM ").append(jobQueue.getTableName()).append(" t1 WHERE ")
- .append(database.buildConjunctionClause(list,new ClauseDescription[]{
- new MultiClause(JobQueue.statusField,new Object[]{
- JobQueue.statusToString(JobQueue.STATUS_COMPLETE),
- JobQueue.statusToString(JobQueue.STATUS_UNCHANGED),
- JobQueue.statusToString(JobQueue.STATUS_PURGATORY),
- JobQueue.statusToString(JobQueue.STATUS_ACTIVEPURGATORY),
- JobQueue.statusToString(JobQueue.STATUS_ACTIVENEEDRESCANPURGATORY),
- JobQueue.statusToString(JobQueue.STATUS_PENDINGPURGATORY)})}));
-
- if (whereClause != null)
- {
- sb.append(" AND EXISTS(SELECT 'x' FROM
").append(jobs.getTableName()).append(" t0 WHERE ")
+ }
+
+ sb.append(" GROUP BY ").append(JobQueue.jobIDField);
+
+ IResultSet set2 = database.performQuery(sb.toString(),list,null,null);
+
+ sb = new StringBuilder("SELECT ");
+ list.clear();
+
+ sb.append(JobQueue.jobIDField).append(",")
+
.append(database.constructCountClause(JobQueue.docHashField)).append(" AS
doccount")
+ .append(" FROM ").append(jobQueue.getTableName()).append(" t1 WHERE
")
+ .append(database.buildConjunctionClause(list,new ClauseDescription[]{
+ new MultiClause(JobQueue.statusField,new Object[]{
+ JobQueue.statusToString(JobQueue.STATUS_ACTIVE),
+ JobQueue.statusToString(JobQueue.STATUS_ACTIVENEEDRESCAN),
+ JobQueue.statusToString(JobQueue.STATUS_PENDING),
+ JobQueue.statusToString(JobQueue.STATUS_ACTIVEPURGATORY),
+
JobQueue.statusToString(JobQueue.STATUS_ACTIVENEEDRESCANPURGATORY),
+ JobQueue.statusToString(JobQueue.STATUS_PENDINGPURGATORY)})}));
+ if (whereClause != null)
+ {
+ sb.append(" AND EXISTS(SELECT 'x' FROM
").append(jobs.getTableName()).append(" t0 WHERE ")
+ .append(database.buildConjunctionClause(list,new
ClauseDescription[]{
+ new
JoinClause("t0."+Jobs.idField,"t1."+JobQueue.jobIDField)})).append(" AND ")
+ .append(whereClause)
+ .append(")");
+ if (whereParams != null)
+ list.addAll(whereParams);
+ }
+ sb.append(" GROUP BY ").append(JobQueue.jobIDField);
+
+ IResultSet set3 = database.performQuery(sb.toString(),list,null,null);
+
+ sb = new StringBuilder("SELECT ");
+ list.clear();
+
+ sb.append(JobQueue.jobIDField).append(",")
+
.append(database.constructCountClause(JobQueue.docHashField)).append(" AS
doccount")
+ .append(" FROM ").append(jobQueue.getTableName()).append(" t1 WHERE
")
.append(database.buildConjunctionClause(list,new ClauseDescription[]{
- new
JoinClause("t0."+Jobs.idField,"t1."+JobQueue.jobIDField)})).append(" AND ")
- .append(whereClause)
- .append(")");
+ new MultiClause(JobQueue.statusField,new Object[]{
+ JobQueue.statusToString(JobQueue.STATUS_COMPLETE),
+ JobQueue.statusToString(JobQueue.STATUS_UNCHANGED),
+ JobQueue.statusToString(JobQueue.STATUS_PURGATORY),
+ JobQueue.statusToString(JobQueue.STATUS_ACTIVEPURGATORY),
+
JobQueue.statusToString(JobQueue.STATUS_ACTIVENEEDRESCANPURGATORY),
+ JobQueue.statusToString(JobQueue.STATUS_PENDINGPURGATORY)})}));
+
+ if (whereClause != null)
+ {
+ sb.append(" AND EXISTS(SELECT 'x' FROM
").append(jobs.getTableName()).append(" t0 WHERE ")
+ .append(database.buildConjunctionClause(list,new
ClauseDescription[]{
+ new
JoinClause("t0."+Jobs.idField,"t1."+JobQueue.jobIDField)})).append(" AND ")
+ .append(whereClause)
+ .append(")");
- if (whereParams != null)
- list.addAll(whereParams);
- }
-
- sb.append(" GROUP BY ").append(JobQueue.jobIDField);
-
- set4 = database.performQuery(sb.toString(),list,null,null);
- }
-
- int i;
-
- // Build hashes for set2 and set3
- HashMap set2Hash = new HashMap();
- if (set2 != null)
- {
- i = 0;
- while (i < set2.getRowCount())
- {
- IResultRow row = set2.getRow(i++);
-
set2Hash.put(row.getValue(JobQueue.jobIDField),row.getValue("doccount"));
- }
- }
- HashMap set3Hash = new HashMap();
- if (set3 != null)
- {
- i = 0;
- while (i < set3.getRowCount())
- {
- IResultRow row = set3.getRow(i++);
-
set3Hash.put(row.getValue(JobQueue.jobIDField),row.getValue("doccount"));
+ if (whereParams != null)
+ list.addAll(whereParams);
+ }
+
+ sb.append(" GROUP BY ").append(JobQueue.jobIDField);
+
+ IResultSet set4 = database.performQuery(sb.toString(),list,null,null);
+
+ for (int j = 0; j < set2.getRowCount(); j++)
+ {
+ IResultRow row = set2.getRow(j);
+ Long jobID = (Long)row.getValue(JobQueue.jobIDField);
+ set2Hash.put(jobID,(Long)row.getValue("doccount"));
+ set2Exact.put(jobID,new Boolean(true));
+ }
+ for (int j = 0; j < set3.getRowCount(); j++)
+ {
+ IResultRow row = set3.getRow(j);
+ Long jobID = (Long)row.getValue(JobQueue.jobIDField);
+ set3Hash.put(jobID,(Long)row.getValue("doccount"));
+ set3Exact.put(jobID,new Boolean(true));
+ }
+ for (int j = 0; j < set4.getRowCount(); j++)
+ {
+ IResultRow row = set4.getRow(j);
+ Long jobID = (Long)row.getValue(JobQueue.jobIDField);
+ set4Hash.put(jobID,(Long)row.getValue("doccount"));
+ set4Exact.put(jobID,new Boolean(true));
+ }
}
- }
- HashMap set4Hash = new HashMap();
- if (set4 != null)
- {
- i = 0;
- while (i < set4.getRowCount())
+ else
{
- IResultRow row = set4.getRow(i++);
-
set4Hash.put(row.getValue(JobQueue.jobIDField),row.getValue("doccount"));
+ // Fire off an individual query with a limit for each job
+ // MHL
}
}
-
+
JobStatus[] rval = new JobStatus[set.getRowCount()];
- i = 0;
- while (i < rval.length)
+ for (int i = 0; i < rval.length; i++)
{
IResultRow row = set.getRow(i);
Long jobID = (Long)row.getValue(Jobs.idField);
@@ -7426,13 +7478,19 @@ public class JobManager implements IJobM
break;
}
- Long set2Value = (Long)set2Hash.get(jobID);
- Long set3Value = (Long)set3Hash.get(jobID);
- Long set4Value = (Long)set4Hash.get(jobID);
-
- rval[i++] = new
JobStatus(jobID.toString(),description,rstatus,((set2Value==null)?0L:set2Value.longValue()),
+ Long set2Value = set2Hash.get(jobID);
+ Long set3Value = set3Hash.get(jobID);
+ Long set4Value = set4Hash.get(jobID);
+ Boolean set2ExactValue = set2Exact.get(jobID);
+ Boolean set3ExactValue = set3Exact.get(jobID);
+ Boolean set4ExactValue = set4Exact.get(jobID);
+
+ rval[i] = new
JobStatus(jobID.toString(),description,rstatus,((set2Value==null)?0L:set2Value.longValue()),
((set3Value==null)?0L:set3Value.longValue()),
((set4Value==null)?0L:set4Value.longValue()),
+ ((set2ExactValue==null)?false:set2ExactValue.booleanValue()),
+ ((set3ExactValue==null)?false:set3ExactValue.booleanValue()),
+ ((set4ExactValue==null)?false:set4ExactValue.booleanValue()),
startTime,endTime,errorText);
}
return rval;