java.lang.Object
net.i2p.router.JobTiming
- All Implemented Interfaces:
Clock.ClockUpdateListener
Define the timing requirements and statistics for a particular job
For use by the router only. Not to be used by applications or plugins.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate longWhen the job really finished, in ms.private longWhen the job really started, in ms.private final RouterContextSupplies the clock the times are taken on.private longWhen the job was scheduled to run, in ms.Constructor Summary
ConstructorsMethod Summary
All MethodsModifier and TypeMethodDescriptionvoidend(long now) Record the actual end.longThe actual end time when the job finished execution.longThe actual start time when the job began execution.long# of milliseconds after the epoch to start the job.voidoffsetChanged(long delta) Adjust all timing values by the specified delta.voidsetActualEnd(long actualEndTime) The actual end time when the job finished execution.voidsetActualStart(long actualStartTime) The actual start time when the job began execution.voidsetStartAfter(long startTime) WARNING - this does not force a resort of the job queue any more...voidstart(long now) Record the actual start.
Field Details
_start
private volatile long _startWhen the job was scheduled to run, in ms._actualStart
private volatile long _actualStartWhen the job really started, in ms._actualEnd
private volatile long _actualEndWhen the job really finished, in ms._context
Supplies the clock the times are taken on.
Constructor Details
JobTiming
Create a JobTiming for the given context.- Parameters:
context- the router context
Method Details
getStartAfter
public long getStartAfter()# of milliseconds after the epoch to start the job.- Returns:
- the scheduled start time
setStartAfter
public void setStartAfter(long startTime) WARNING - this does not force a resort of the job queue any more... ALWAYS callJobImpl.requeue(long)instead if job is already queued.- Parameters:
startTime- the new start time
getActualStart
public long getActualStart()The actual start time when the job began execution.- Returns:
- the actual start time
setActualStart
public void setActualStart(long actualStartTime) The actual start time when the job began execution.- Parameters:
actualStartTime- the actual start time
start
public void start(long now) Record the actual start.The caller supplies the timestamp because JobQueueRunner already reads the clock once per job and reuses that value for the run start, the queue-wait origin and the lag origin; a second read here only added clock skew between the timing record and the reported lag.
- Parameters:
now- the actual start time in milliseconds
getActualEnd
public long getActualEnd()The actual end time when the job finished execution.- Returns:
- the actual end time
setActualEnd
public void setActualEnd(long actualEndTime) The actual end time when the job finished execution.- Parameters:
actualEndTime- the actual end time
end
public void end(long now) Record the actual end.As with
start(long), the caller passes in a clock reading it already needs, keeping the duration consistent with the timestamp JobQueueRunner takes around updateStats().- Parameters:
now- the actual end time in milliseconds
offsetChanged
public void offsetChanged(long delta) Adjust all timing values by the specified delta.- Specified by:
offsetChangedin interfaceClock.ClockUpdateListener- Parameters:
delta- = (new offset - old offset), where each offset = (now() -System.currentTimeMillis())