Class HibernateJobQueue
java.lang.Object
org.mapfish.print.servlet.job.impl.hibernate.HibernateJobQueue
- All Implemented Interfaces:
JobQueue
Transfers request to the Job dao.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidadd(PrintJobEntry jobEntry) Add new job entry to the queue.final voidMark job as canceling (if running) or canceled (if waiting / finished).final voidCancel old WAITING tasks.voidDelete the job.final voiddone(String referenceId, PrintJobResult result) Mark job as done.final voidMark job as failed.final PrintJobStatusReturn the completed job object if the job has completed or absent otherwise.final longGet the average time print jobs take to complete.final longGet the number of prints that finished (either by error or success).final longGet the total number of print requests made.final longReturn the amount of time the queue will keep an entry before purging the record.final longGet the total number of waiting/running jobs.final voidinit()Called by spring on initialization.final voidsetTimeToKeepAfterAccessInMinutes(int timeToKeepAfterAccessInMinutes) final voidshutdown()Called by spring when application context is being destroyed.final List<? extends PrintJobStatus> start(int number) Start the next [N] number of jobs at once.final voidMark job as running.longtimeSinceLastStatusCheck(String referenceId) Get the time since a client has last requested the print job.final List<? extends PrintJobStatus> toCancel()Get the jobs that are marked as "CANCELING" and must be canceled.
-
Constructor Details
-
HibernateJobQueue
public HibernateJobQueue()
-
-
Method Details
-
setTimeToKeepAfterAccessInMinutes
public final void setTimeToKeepAfterAccessInMinutes(int timeToKeepAfterAccessInMinutes) -
getTimeToKeepAfterAccessInMillis
public final long getTimeToKeepAfterAccessInMillis()Description copied from interface:JobQueueReturn the amount of time the queue will keep an entry before purging the record.- Specified by:
getTimeToKeepAfterAccessInMillisin interfaceJobQueue- 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
public final long getLastPrintCount()Description copied from interface:JobQueueGet the number of prints that finished (either by error or success).- Specified by:
getLastPrintCountin interfaceJobQueue
-
getWaitingJobsCount
public final long getWaitingJobsCount()Description copied from interface:JobQueueGet the total number of waiting/running jobs.- Specified by:
getWaitingJobsCountin interfaceJobQueue
-
getNumberOfRequestsMade
public final long getNumberOfRequestsMade()Description copied from interface:JobQueueGet the total number of print requests made.- Specified by:
getNumberOfRequestsMadein interfaceJobQueue
-
getAverageTimeSpentPrinting
public final long getAverageTimeSpentPrinting()Description copied from interface:JobQueueGet the average time print jobs take to complete.- Specified by:
getAverageTimeSpentPrintingin interfaceJobQueue
-
timeSinceLastStatusCheck
Description copied from interface:JobQueueGet the time since a client has last requested the print job.- Specified by:
timeSinceLastStatusCheckin interfaceJobQueue- Parameters:
referenceId- the id of the print job
-
get
public final PrintJobStatus get(String referenceId, boolean external) throws NoSuchReferenceException Description copied from interface:JobQueueReturn the completed job object if the job has completed or absent otherwise.- Specified by:
getin interfaceJobQueue- Parameters:
referenceId- the referenceId of the report to lookupexternal- true if external status request- Throws:
NoSuchReferenceException
-
add
Description copied from interface:JobQueueAdd new job entry to the queue. -
cancel
public final void cancel(String referenceId, String message, boolean forceFinal) throws NoSuchReferenceException Description copied from interface:JobQueueMark job as canceling (if running) or canceled (if waiting / finished).- Specified by:
cancelin interfaceJobQueue- Parameters:
referenceId- reference id to the job that has failed.message- the error messageforceFinal- finalize, even if status is running- Throws:
NoSuchReferenceException
-
fail
Description copied from interface:JobQueueMark job as failed.- Specified by:
failin interfaceJobQueue- Parameters:
referenceId- reference id to the job that has failed.message- the error message- Throws:
NoSuchReferenceException
-
start
Description copied from interface:JobQueueMark job as running.- Specified by:
startin interfaceJobQueue- Parameters:
referenceId- reference id to the job to start.- Throws:
NoSuchReferenceException
-
done
Description copied from interface:JobQueueMark job as done.- Specified by:
donein interfaceJobQueue- Parameters:
referenceId- reference id to the job that is done.result- the result of the print job- Throws:
NoSuchReferenceException
-
cancelOld
Description copied from interface:JobQueueCancel old WAITING tasks. -
start
Description copied from interface:JobQueueStart the next [N] number of jobs at once. -
toCancel
Description copied from interface:JobQueueGet the jobs that are marked as "CANCELING" and must be canceled. -
delete
Description copied from interface:JobQueueDelete the job. -
init
@PostConstruct public final void init()Called by spring on initialization. -
shutdown
@PreDestroy public final void shutdown()Called by spring when application context is being destroyed.
-