## net.i2p.router
Class JobQueue

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

    public class JobQueue

extends 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()`
`boolean` `isJobActive(Job job)` Returns `true` if a given job is waiting or running; `false` if the job is finished or doesn't exist in the queue.
`void` `removeJob(Job job)`
`(package private) void` `removeRunner(int id)`
`void` `renderStatusHTML(Writer out)`
`void` `restart()` Deprecated. do you really want to do this?
`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)

### isJobActive

    public boolean isJobActive(Job job)

  Returns `true` if a given job is waiting or running; `false` if the job is finished or doesn't exist in the queue.

### timingUpdated

    public void timingUpdated()

### getReadyCount

    public int getReadyCount()

### getMaxLag

    public long getMaxLag()

### allowParallelOperation

    public void allowParallelOperation()

### restart

    public void restart()

  Deprecated. do you really want to do this?

### 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(Writer out)
                          throws IOException

  Throws:
    `IOException`