java.lang.Object
net.i2p.router.web.HelperBase
net.i2p.router.web.helpers.JobQueueHelper

public class JobQueueHelperextends HelperBase
Helper for job queue page rendering and form processing.
  • Field Details

    • MAX_JOBS_DISPLAYED

      private static int MAX_JOBS_DISPLAYED
      Most jobs listed on the page.
    • RECENT_WINDOW_MS

      private static final long RECENT_WINDOW_MS
      Window counting a job as recently run.
      See Also:
    • _requestURI

      private String _requestURI
      URI of the request being rendered.
  • Constructor Details

    • JobQueueHelper

      public JobQueueHelper()
      Constructor. The console builds this helper per page render and points it at the request URI through the bean setter, so a bare instance is the starting state.
  • Method Details

    • setRequestURI

      public void setRequestURI(String uri)
      Set the request URI.
      Parameters:
      uri - the request URI
    • isRecentMode

      private boolean isRecentMode()
      Whether the page shows the recently run jobs.
      Returns:
      true in the recent view
    • getJobQueueSummary

      public String getJobQueueSummary()
      Get the job queue summary HTML.
      Returns:
      the HTML summary
    • getJobQueueStats

      public String getJobQueueStats()
      Get the job queue stats HTML.
      Returns:
      the HTML stats
    • renderStatusHTML

      private void renderStatusHTML(Writer out) throws IOException
      Moved from JobQueue.
      Parameters:
      out - the writer the job queue status HTML is appended to
      Throws:
      IOException - if writing to out fails
    • groupByNameAndTime

      private static List<JobQueueHelper.JobGroup> groupByNameAndTime(List<Job> jobs, JobQueueHelper.JobTimeFn timeFn)
      Group the jobs by name, then by the time key derived from each job.
      Parameters:
      jobs - the jobs to group
      timeFn - derives the time key for each job
      Returns:
      the groups, in no particular order - sort before display
    • jobNameDisplay

      private static String jobNameDisplay(String jobName, List<Job> jobs)
      Build the job name label, with a count badge when the group holds several jobs.
      Parameters:
      jobName - the job name
      jobs - the jobs in the group
      Returns:
      the HTML label
    • renderJobStatsHTML

      private void renderJobStatsHTML(Writer out) throws IOException
      Renders the job statistics table.
      Parameters:
      out - the writer to render into
      Throws:
      IOException - if the writing fails
    • getJobCounts

      private void getJobCounts(StringBuilder buf, ObjectCounterUnsafe<String> counter, int scheduledCount)
      Append per-job counts to the buffer.
      Parameters:
      buf - the buffer the job count HTML list is appended to
      counter - per-job counts keyed by job name
      scheduledCount - number of timed jobs, added to the ready count for the queue total
    • getJobStats

      private void getJobStats(StringBuilder buf)
      Render the HTML for the job stats. Moved from JobQueue.
      Parameters:
      buf - the buffer the job statistics HTML is appended to