Package 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. For use by the router only. Not to be used by applications or plugins.
-
-
Constructor Summary
Constructors Constructor Description JobQueue(RouterContext context)Does not start the pumper.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddJob(Job job)Enqueue the specified jobvoidallowParallelOperation()intgetJobs(Collection<Job> readyJobs, Collection<Job> timedJobs, Collection<Job> activeJobs, Collection<Job> justFinishedJobs)Dump the current state.Collection<JobStats>getJobStats()Current job stats.JobgetLastJob()retrieve the most recently begin and still currently active job, or null if no jobs are runninglonggetLastJobBegin()When did the most recently begin job start?longgetLastJobEnd()When did the most recently begin job start?longgetMaxLag()(package private) JobgetNext()Blocking call to retrieve the next ready jobintgetReadyCount()(package private) booleanisAlive()booleanisJobActive(Job job)Deprecated.unusedvoidremoveJob(Job job)(package private) voidremoveRunner(int id)voidrenderStatusHTML(Writer out)Deprecated.moved to router consolevoidrestart()Deprecated.do you really want to do this?voidrunQueue(int numThreads)Start up the queue with the specified number of concurrent processors.(package private) voidshutdown()voidstartup()Start the pumper.voidtimingUpdated()Deprecated.contention - see JobTiming.setStartAfter() comments(package private) voidupdateStats(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)
-
-
-
Constructor Detail
-
JobQueue
public JobQueue(RouterContext context)
Does not start the pumper. Caller MUST call startup.
-
-
Method Detail
-
addJob
public void addJob(Job job)
Enqueue the specified job
-
removeJob
public void removeJob(Job job)
-
isJobActive
@Deprecated public boolean isJobActive(Job job)
Deprecated.unusedReturnstrueif a given job is waiting or running;falseif the job is finished or doesn't exist in the queue.
-
timingUpdated
@Deprecated public void timingUpdated()
Deprecated.contention - see JobTiming.setStartAfter() comments
-
getReadyCount
public int getReadyCount()
-
getMaxLag
public long getMaxLag()
-
allowParallelOperation
public void allowParallelOperation()
-
startup
public void startup()
Start the pumper.- Since:
- 0.9.19
-
restart
@Deprecated 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?- Since:
- Broken before 0.9.51, always returned -1
-
getLastJobEnd
public long getLastJobEnd()
When did the most recently begin job start?- Since:
- Broken before 0.9.51, always returned -1
-
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 increase the number of runners if necessary. This does not ever stop or reduce threads.
-
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)
-
getJobs
public int getJobs(Collection<Job> readyJobs, Collection<Job> timedJobs, Collection<Job> activeJobs, Collection<Job> justFinishedJobs)
Dump the current state. For the router console jobs status page.- Parameters:
readyJobs- out parametertimedJobs- out parameteractiveJobs- out parameterjustFinishedJobs- out parameter- Returns:
- number of job runners
- Since:
- 0.8.9
-
getJobStats
public Collection<JobStats> getJobStats()
Current job stats. For the router console jobs status page.- Since:
- 0.8.9
-
renderStatusHTML
@Deprecated public void renderStatusHTML(Writer out) throws IOException
Deprecated.moved to router console- Throws:
IOException
-
-