java.lang.Object
net.i2p.router.JobImpl
net.i2p.router.networkdb.kademlia.FloodSearchJob
net.i2p.router.networkdb.kademlia.FloodOnlySearchJob
net.i2p.router.networkdb.kademlia.DirectLookupJob
- All Implemented Interfaces:
Job
Ask a connected peer for his RI. Modified from
SingleSearchJob.Mainly for older routers. As of 0.9.55, transports will periodically send their RI. Some old routers may not respond or may send DSRM, e.g. if hidden (and i2pd?).
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final RouterInfoThe entry as it was before the lookup.private OutNetMessageThe lookup message awaiting a reply.private static final intHow long to wait for the reply - 8 seconds.Fields inherited from class FloodOnlySearchJob
_onReply, _onTimeout, _replySelectorModifier and TypeFieldDescriptionprotected final ReplyJobJob to run on reply.protected final JobJob to run on timeout.protected final MessageSelectorReply message selector.Fields inherited from class FloodSearchJob
_created, _dead, _expiration, _facade, _isLease, _key, _log, _lookupsRemaining, _onFailed, _onFind, _success, _timeoutMs, CONCURRENT_SEARCHESModifier and TypeFieldDescriptionprotected final longSystem time when this search was created.protected booleanWhether this search has been marked as completed.protected longDeadline after which the search expires.protected final FloodfillNetworkDatabaseFacadeFloodfill network database facade.protected final booleanWhether the target is a LeaseSet lookup.protected final HashTarget database entry hash being searched.protected final LogClass logger.protected final AtomicIntegerRemaining flood lookups before fallback to iterative search.Callbacks for search failure.Callbacks for successful search completion.protected booleanWhether the search completed successfully.protected intTimeout for the search in milliseconds.protected static final intMax simultaneous flood lookups before fallback.Constructor Summary
ConstructorsConstructorDescriptionDirectLookupJob(RouterContext ctx, FloodfillNetworkDatabaseFacade facade, Hash peer, RouterInfo oldRI, Job onFind, Job onFail) Request is sent to; if null the job fails without sending anything.Method Summary
Public MethodsModifier and TypeMethodDescription(package private) voidfailed()Deprecated, unused, see FOSJ override.getName()Deprecated, unused, see FOSJ override.voidrunJob()Deprecated, unused, see FOSJ override.booleanWhether a DSRM reply should be processed.(package private) voidsuccess()Deprecated, unused, see FOSJ override.Methods inherited from class FloodOnlySearchJob
decrementRemainingModifier and TypeMethodDescription(package private) intdecrementRemaining(Hash peer) Note that we heard from the peer.Methods inherited from class FloodSearchJob
addDeferred, decrementRemaining, getCreated, getExpiration, getKey, getLookupsRemainingModifier and TypeMethodDescription(package private) voidaddDeferred(Job onFind, Job onFailed, long timeoutMs, boolean isLease) Add jobs to an existing search.protected intNumber of lookups remaining after decrementing.longSystem time, NOT context time.longExpiration time from the context clock.getKey()The database entry hash being searched.protected intNumber of flood lookups still pending.Methods 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
_onm
The lookup message awaiting a reply._oldRI
The entry as it was before the lookup.TIMEOUT
private static final int TIMEOUTHow long to wait for the reply - 8 seconds.- See Also:
Constructor Details
DirectLookupJob
public DirectLookupJob(RouterContext ctx, FloodfillNetworkDatabaseFacade facade, Hash peer, RouterInfo oldRI, Job onFind, Job onFail) Request is sent to; if null the job fails without sending anything.- Parameters:
ctx- the router contextfacade- the floodfill network database facade to report completion topeer- for Router Info onlyoldRI- the RouterInfo whose freshness triggered this lookup, and the address theonFind- job to run on a successful findonFail- job to run if the peer does not answer before the timeout
Method Details
getName
Description copied from class:FloodSearchJobDeprecated, unused, see FOSJ override.- Specified by:
getNamein interfaceJob- Overrides:
getNamein classFloodOnlySearchJob- Returns:
- the fixed descriptive name
"NetDb Search (phase 1)"of this job
shouldProcessDSRM
public boolean shouldProcessDSRM()Description copied from class:FloodOnlySearchJobWhether a DSRM reply should be processed.- Overrides:
shouldProcessDSRMin classFloodOnlySearchJob- Returns:
- true if DSRM should be processed
runJob
public void runJob()Description copied from class:FloodSearchJobDeprecated, unused, see FOSJ override.- Specified by:
runJobin interfaceJob- Overrides:
runJobin classFloodOnlySearchJob
failed
void failed()Description copied from class:FloodSearchJobDeprecated, unused, see FOSJ override.- Overrides:
failedin classFloodOnlySearchJob
success
void success()Description copied from class:FloodSearchJobDeprecated, unused, see FOSJ override.- Overrides:
successin classFloodOnlySearchJob