java.lang.Object
net.i2p.router.JobImpl
net.i2p.router.networkdb.kademlia.FloodSearchJob
net.i2p.router.networkdb.kademlia.FloodOnlySearchJob
net.i2p.router.networkdb.kademlia.SingleSearchJob
- All Implemented Interfaces:
Job
- Direct Known Subclasses:
IterativeFollowupJob
Performs a targeted lookup to a single peer for a specific key.
This specialized search job queries exactly one peer for a RouterInfo associated with the target key. Despite extending FloodOnlySearchJob, this is not a flood operation but rather a direct, point-to-point lookup designed for specific scenarios where the target peer is known.
Used primarily for followup operations and targeted peer validation where the response from a specific peer is required. The job handles tunnel selection, message construction, and timeout management for reliable single-peer communication.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate OutNetMessageThe lookup message awaiting a reply.private final HashThe hash being looked up.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
ConstructorsConstructorDescriptionSingleSearchJob(RouterContext ctx, Hash key, Hash to) Send one DatabaseLookupMessage straight to a chosen peer over exploratory tunnels, instead of flooding the networkDb with it.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
_to
The hash being looked up._onm
The lookup message awaiting a reply.TIMEOUT
private static final int TIMEOUTHow long to wait for the reply - 8 seconds.- See Also:
Constructor Details
SingleSearchJob
Send one DatabaseLookupMessage straight to a chosen peer over exploratory tunnels, instead of flooding the networkDb with it.- Parameters:
ctx- the router context for the parent search jobkey- for Router Info ONLYto- the peer the lookup is sent to
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