java.lang.Object
net.i2p.router.JobQueue.QueuePumper
All Implemented Interfaces:
Runnable, RouterClock.ClockShiftListener, Clock.ClockUpdateListener
Enclosing class:
JobQueue

private final class JobQueue.QueuePumperextends Object implements Runnable, Clock.ClockUpdateListener, RouterClock.ClockShiftListener
Thread pumping the ready jobs to the runners.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final List<Job>
    Scratch buffer for the jobs a single pass promotes out of _timedJobs, reused across passes so a 100 Hz pumper does not allocate per pass.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Builds the queue pumper thread.
  • Method Summary

    All Methods
    Modifier and Type
    Method
    Description
    void
    clockShift(long delta)
    Handle a clock shift event.
    void
    offsetChanged(long delta)
    Handle a clock offset change.
    void
    run()
    Pump jobs from the scheduling queue to the runner queue.

    Methods inherited from class Object

    clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • _toMove

      private final List<Job> _toMove
      Scratch buffer for the jobs a single pass promotes out of _timedJobs, reused across passes so a 100 Hz pumper does not allocate per pass. Emptied after the move so it never retains Job references between passes.
  • Constructor Details

    • QueuePumper

      public QueuePumper()
      Builds the queue pumper thread.
  • Method Details

    • run

      public void run()
      Pump jobs from the scheduling queue to the runner queue.

      The iteration and removal of _timedJobs happens outside the lock because ConcurrentSkipListSet supports safe concurrent iteration. Only the wait/notify signaling needs _jobLock, reducing contention with addJob() which must also acquire _jobLock.

      Specified by:
      run in interface Runnable
    • offsetChanged

      public void offsetChanged(long delta)
      Handle a clock offset change.
      Specified by:
      offsetChanged in interface Clock.ClockUpdateListener
      Parameters:
      delta - = (new offset - old offset), where each offset = (now() - System.currentTimeMillis())
    • clockShift

      public void clockShift(long delta)
      Handle a clock shift event.
      Specified by:
      clockShift in interface RouterClock.ClockShiftListener
      Parameters:
      delta - The system clock and adjusted clock just changed by this much, in milliseconds (approximately)