All Implemented Interfaces:
Runnable

class JobQueueRunnerextends I2PThread
Worker thread that executes jobs from the router job queue. Handles job execution, timing collection, error handling, and performance monitoring for individual job processing threads.
  • Field Details

    • _log

      private final Log _log
      The log for the runner.
    • _context

      private final RouterContext _context
      The router context.
    • _keepRunning

      private volatile boolean _keepRunning
      True while the runner should keep running.
    • _id

      private final int _id
      The id of this runner.
    • _currentJob

      private volatile Job _currentJob
      The job running right now.
    • _lastJob

      private volatile Job _lastJob
      The job that ran last.
    • _lastBegin

      private volatile long _lastBegin
      When the last job began.
    • _lastEnd

      private volatile long _lastEnd
      When the last job ended.
    • _jobRunStat

      private volatile RateStat _jobRunStat
      Cached "jobQueue.jobRun" handle, resolved on first use. Null until resolved, and it stays null when stat.full is off (in which case JobQueue's createRateStat() is a no-op). Resolution is idempotent, so a benign race can only assign the same handle twice.
    • _jobLagStat

      private volatile RateStat _jobLagStat
      Cached "jobQueue.jobLag" handle, resolved on first use. @since 0.9.71+.
    • _jobWaitStat

      private volatile RateStat _jobWaitStat
      Cached "jobQueue.jobWait" handle, resolved on first use. @since 0.9.71+.
  • Constructor Details

    • JobQueueRunner

      public JobQueueRunner(RouterContext context, int id)
      Create a new job queue runner.
      Parameters:
      context - the router context
      id - the runner id
  • Method Details

    • getCurrentJob

      public Job getCurrentJob()
      The job currently being executed.
      Returns:
      the current job
    • getLastJob

      public Job getLastJob()
      The most recently completed job.
      Returns:
      the last job
    • getRunnerId

      public int getRunnerId()
      Identifier for this runner.
      Returns:
      the runner id
    • stopRunning

      public void stopRunning()
      Stop the runner.
    • startRunning

      public void startRunning()
      Start the runner.
    • getLastBegin

      public long getLastBegin()
      When the job that ran most recently started.
      Returns:
      adjusted time in ms, 0 until the first job has started
    • getLastEnd

      public long getLastEnd()
      When the job that ran most recently finished, stats update included.
      Returns:
      adjusted time in ms, 0 until the first job has finished
    • resolveStats

      private void resolveStats()
      Resolve the cached RateStat handles for the three per-job stats.

      Every job used to pay three string-keyed ConcurrentHashMap lookups in StatManager, and each handle then fans out to a synchronized Rate per period - nine monitor acquisitions per job across three periods. The stats are created once by the JobQueue constructor before any runner exists, so caching the handles removes the lookups without changing which rates receive data. Left null when the stat was never created (stat.full off), in which case the update is skipped, matching StatManager.addRateData(String, long, long)'s own no-op.

    • run

      public void run()
      Description copied from class: I2PThread
      Run the thread, catching and reporting OOM and other failures.
      Specified by:
      run in interface Runnable
      Overrides:
      run in class I2PThread
    • runCurrentJob

      private void runCurrentJob()
      Runs the job taken from the queue.