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 Details

    • 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(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(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 lookup
      external - 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(String referenceId, 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 message
      forceFinal - finalize, even if status is running
      Throws:
      NoSuchReferenceException
    • fail

      void fail(String referenceId, 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(String referenceId) throws NoSuchReferenceException
      Mark job as running.
      Parameters:
      referenceId - reference id to the job to start.
      Throws:
      NoSuchReferenceException
    • done

      void done(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, String message)
      Cancel old WAITING tasks.
      Parameters:
      startTimeOut - time-out value from when job started
      abandonTimeout - time-out value form last status request
      message - error message
    • start

      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

      List<? extends PrintJobStatus> toCancel()
      Get the jobs that are marked as "CANCELING" and must be canceled.
    • delete

      void delete(String referenceId)
      Delete the job.
      Parameters:
      referenceId - reference id to the job.