Package org.mapfish.print.servlet.job
Interface JobQueue
-
- All Known Implementing Classes:
HibernateJobQueue
,RegistryJobQueue
public interface JobQueue
Manages the Statuses of the Print Jobs. Should not be used directly unless by Job Manager.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
add(PrintJobEntry jobEntry)
Add new job entry to the queue.void
cancel(java.lang.String referenceId, java.lang.String message, boolean forceFinal)
Mark job as canceling (if running) or canceled (if waiting / finished).void
cancelOld(long startTimeOut, long abandonTimeout, java.lang.String message)
Cancel old WAITING tasks.void
delete(java.lang.String referenceId)
Delete the job.void
done(java.lang.String referenceId, PrintJobResult result)
Mark job as done.void
fail(java.lang.String referenceId, java.lang.String message)
Mark job as failed.PrintJobStatus
get(java.lang.String referenceId, boolean external)
Return the completed job object if the job has completed or absent otherwise.long
getAverageTimeSpentPrinting()
Get the average time print jobs take to complete.long
getLastPrintCount()
Get the number of prints that finished (either by error or success).long
getNumberOfRequestsMade()
Get the total number of print requests made.long
getTimeToKeepAfterAccessInMillis()
Return the amount of time the queue will keep an entry before purging the record.long
getWaitingJobsCount()
Get the total number of waiting/running jobs.java.util.List<? extends PrintJobStatus>
start(int number)
Start the next [N] number of jobs at once.void
start(java.lang.String referenceId)
Mark job as running.long
timeSinceLastStatusCheck(java.lang.String referenceId)
Get the time since a client has last requested the print job.java.util.List<? extends PrintJobStatus>
toCancel()
Get the jobs that are marked as "CANCELING" and must be canceled.
-
-
-
Method Detail
-
getTimeToKeepAfterAccessInMillis
long getTimeToKeepAfterAccessInMillis()
Return the amount of time the queue will keep an entry before purging the record.- Returns:
- the number of milliseconds between the last access of a record and the time when a record can be purged from the registry. -1 if there it is unlimited.
-
getLastPrintCount
long getLastPrintCount()
Get the number of prints that finished (either by error or success).
-
getAverageTimeSpentPrinting
long getAverageTimeSpentPrinting()
Get the average time print jobs take to complete.
-
getNumberOfRequestsMade
long getNumberOfRequestsMade()
Get the total number of print requests made.
-
timeSinceLastStatusCheck
long timeSinceLastStatusCheck(java.lang.String referenceId)
Get the time since a client has last requested the print job.- Parameters:
referenceId
- the id of the print job
-
getWaitingJobsCount
long getWaitingJobsCount()
Get the total number of waiting/running jobs.
-
get
PrintJobStatus get(java.lang.String referenceId, boolean external) throws NoSuchReferenceException
Return the completed job object if the job has completed or absent otherwise.- Parameters:
referenceId
- the referenceId of the report to lookupexternal
- true if external status request- Throws:
NoSuchReferenceException
-
add
void add(PrintJobEntry jobEntry)
Add new job entry to the queue.- Parameters:
jobEntry
- the job to run.
-
cancel
void cancel(java.lang.String referenceId, java.lang.String message, boolean forceFinal) throws NoSuchReferenceException
Mark job as canceling (if running) or canceled (if waiting / finished).- Parameters:
referenceId
- reference id to the job that has failed.message
- the error messageforceFinal
- finalize, even if status is running- Throws:
NoSuchReferenceException
-
fail
void fail(java.lang.String referenceId, java.lang.String message) throws NoSuchReferenceException
Mark job as failed.- Parameters:
referenceId
- reference id to the job that has failed.message
- the error message- Throws:
NoSuchReferenceException
-
start
void start(java.lang.String referenceId) throws NoSuchReferenceException
Mark job as running.- Parameters:
referenceId
- reference id to the job to start.- Throws:
NoSuchReferenceException
-
done
void done(java.lang.String referenceId, PrintJobResult result) throws NoSuchReferenceException
Mark job as done.- Parameters:
referenceId
- reference id to the job that is done.result
- the result of the print job- Throws:
NoSuchReferenceException
-
cancelOld
void cancelOld(long startTimeOut, long abandonTimeout, java.lang.String message)
Cancel old WAITING tasks.- Parameters:
startTimeOut
- time-out value from when job startedabandonTimeout
- time-out value form last status requestmessage
- error message
-
start
java.util.List<? extends PrintJobStatus> start(int number)
Start the next [N] number of jobs at once.- Parameters:
number
- the number of jobs to start- Returns:
- the jobs that were just started
-
toCancel
java.util.List<? extends PrintJobStatus> toCancel()
Get the jobs that are marked as "CANCELING" and must be canceled.
-
delete
void delete(java.lang.String referenceId)
Delete the job.- Parameters:
referenceId
- reference id to the job.
-
-