Package net.i2p.router
Class JobQueue
java.lang.Object
net.i2p.router.JobQueue
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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Enqueue the specified jobvoid
int
getJobs
(Collection<Job> readyJobs, Collection<Job> timedJobs, Collection<Job> activeJobs, Collection<Job> justFinishedJobs) Dump the current state.Current job stats.retrieve the most recently begin and still currently active job, or null if no jobs are runninglong
When did the most recently begin job start?long
When did the most recently begin job start?long
(package private) Job
getNext()
Blocking call to retrieve the next ready jobint
(package private) boolean
isAlive()
boolean
isJobActive
(Job job) Deprecated.unusedvoid
(package private) void
removeRunner
(int id) void
renderStatusHTML
(Writer out) Deprecated.moved to router consolevoid
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
startup()
Start the pumper.void
Deprecated.contention - see JobTiming.setStartAfter() comments(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)
-
Constructor Details
-
JobQueue
Does not start the pumper. Caller MUST call startup.
-
-
Method Details
-
addJob
Enqueue the specified job -
removeJob
-
isJobActive
Deprecated.unusedReturnstrue
if a given job is waiting or running;false
if the job is finished or doesn't exist in the queue. -
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.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
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
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
Current job stats. For the router console jobs status page.- Since:
- 0.8.9
-
renderStatusHTML
Deprecated.moved to router console- Throws:
IOException
-