## net.i2p.router
Class JobQueue

    java.lang.Object
      net.i2p.router.JobQueue

    public class JobQueue

extends java.lang.Object

Manage the pending jobs according to whatever algorithm is appropriate, giving preference to earlier scheduled jobs.

Constructor Summary
`JobQueue(RouterContext context)`

Method Summary
`void` `addJob(Job job)` Enqueue the specified job
`void` `allowParallelOperation()`
`Job` `getLastJob()` retrieve the most recently begin and still currently active job, or null if no jobs are running
`long` `getLastJobBegin()` When did the most recently begin job start?
`long` `getLastJobEnd()` When did the most recently begin job start?
`long` `getMaxLag()`
`(package private) Job` `getNext()` Blocking call to retrieve the next ready job
`int` `getReadyCount()`
`(package private) boolean` `isAlive()`
`void` `removeJob(Job job)`
`(package private) void` `removeRunner(int id)`
`void` `renderStatusHTML(java.io.Writer out)`
`void` `restart()`
`void` `runQueue(int numThreads)` Start up the queue with the specified number of concurrent processors.
`(package private) void` `shutdown()`
`void` `timingUpdated()`
`(package private) void` `updateStats(Job job, long doStart, long origStartAfter, long duration)` calculate and update the job timings if it was lagged too much or took too long to run, spit out a warning (and if its really excessive, kill the router)

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### JobQueue

    public JobQueue(RouterContext context)

Method Detail

### addJob

    public void addJob(Job job)

  Enqueue the specified job

### removeJob

    public void removeJob(Job job)

### timingUpdated

    public void timingUpdated()

### getReadyCount

    public int getReadyCount()

### getMaxLag

    public long getMaxLag()

### allowParallelOperation

    public void allowParallelOperation()

### restart

    public void restart()

### shutdown

    void shutdown()

### isAlive

    boolean isAlive()

### getLastJobBegin

    public long getLastJobBegin()

  When did the most recently begin job start?

### getLastJobEnd

    public long getLastJobEnd()

  When did the most recently begin job start?

### getLastJob

    public Job getLastJob()

  retrieve the most recently begin and still currently active job, or null if no jobs are running

### getNext

    Job getNext()

  Blocking call to retrieve the next ready job

### runQueue

    public void runQueue(int numThreads)

  Start up the queue with the specified number of concurrent processors. If this method has already been called, it will adjust the number of runners to meet the new number. This does not kill jobs running on excess threads, it merely instructs the threads to die after finishing the current job.

### removeRunner

    void removeRunner(int id)

### updateStats

    void updateStats(Job job,
                     long doStart,
                     long origStartAfter,
                     long duration)

  calculate and update the job timings if it was lagged too much or took too long to run, spit out a warning (and if its really excessive, kill the router)

### renderStatusHTML

    public void renderStatusHTML(java.io.Writer out)
                          throws java.io.IOException

  Throws:
    `java.io.IOException`