java.lang.Object
net.i2p.router.JobImpl
net.i2p.router.tunnel.pool.BuildHandler.TimeoutReq
- All Implemented Interfaces:
Job
- Enclosing class:
BuildHandler
Job that times out one unanswered build request.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AtomicBooleanGuard so the pending count drops only once.private final HashThe next hop that never answered.private final BuildRequestRecordThe record of the request being timed out.private final intRetries still allowed for this request.private final BuildHandler.BuildMessageStateThe build message being timed out.Constructor Summary
ConstructorsConstructorDescriptionTimeoutReq(RouterContext ctx, BuildHandler.BuildMessageState state, BuildRequestRecord req, Hash nextPeer, AtomicBoolean decremented, int retriesLeft) Prepares to time out one build request.Method Summary
All MethodsMethods inherited from class JobImpl
dropped, getContext, getJobId, getMadeReadyOn, getTiming, madeReady, requeue, toStringModifier and TypeMethodDescriptionvoiddropped()Default implementation does nothing.final RouterContextThe router context that this job belongs to.longgetJobId()The unique job ID for this job.longThe timestamp when this job was last made ready for execution.The timing object for this job.voidmadeReady(long now) For JobQueue only, not for external use.protected voidrequeue(long delayMs) Requeue this job to run after the specified delay.toString()
Field Details
_state
The build message being timed out._req
The record of the request being timed out._nextPeer
The next hop that never answered._decremented
Guard so the pending count drops only once._retriesLeft
private final int _retriesLeftRetries still allowed for this request.
Constructor Details
TimeoutReq
TimeoutReq(RouterContext ctx, BuildHandler.BuildMessageState state, BuildRequestRecord req, Hash nextPeer, AtomicBoolean decremented, int retriesLeft) Prepares to time out one build request.- Parameters:
ctx- the router doing the timing outstate- the build message to time outreq- the record of the requestnextPeer- the next hop that never answereddecremented- guard so the pending count drops onceretriesLeft- retries still allowed
Method Details
getName
The name of this job.- Returns:
- the job name used for logging and identification
runJob
public void runJob()The next-hop lookup ran out of time. First re-check the local netdb — the RI may have landed just as the timeout fired, which turns the common race into a success. If it really is a local miss, retry the lookup once while the originator's budget still allows a full second attempt: the timeout is not evidence against the peer, and rejecting threw away builds a retry completes. Only when the budget is exhausted (or retries are used up) is the request rejected. The reject leaves the peer's profile untouched and any established connection kept: blaming healthy peers here degraded selection quality over time, and mayDisconnect() shed connections that later builds could have used.