net.i2p.router.networkdb.kademlia
Class FloodSearchJob

java.lang.Object
  extended by net.i2p.router.JobImpl
      extended by net.i2p.router.networkdb.kademlia.FloodSearchJob
All Implemented Interfaces:
Job
Direct Known Subclasses:
FloodOnlySearchJob

public class FloodSearchJob
extends JobImpl

Try sending a search to some floodfill peers, but if we don't get a successful match within half the allowed lookup time, give up and start querying through the normal (kademlia) channels. This should cut down on spurious lookups caused by simple delays in responses from floodfill peers NOTE: Unused directly - see FloodOnlySearchJob extension which overrides almost everything. TODO: Comment out or delete what we don't use here. Note that this does NOT extend SearchJob.


Field Summary
protected  boolean _dead
           
protected  long _expiration
           
protected  FloodfillNetworkDatabaseFacade _facade
           
protected  boolean _isLease
           
protected  Hash _key
           
protected  Log _log
           
protected  int _lookupsRemaining
           
protected  java.util.List<Job> _onFailed
           
protected  java.util.List<Job> _onFind
           
protected  long _origExpiration
           
protected  int _timeoutMs
           
 
Constructor Summary
FloodSearchJob(RouterContext ctx, FloodfillNetworkDatabaseFacade facade, Hash key, Job onFind, Job onFailed, int timeoutMs, boolean isLease)
           
 
Method Summary
(package private)  void addDeferred(Job onFind, Job onFailed, long timeoutMs, boolean isLease)
           
protected  void decrementRemaining()
           
(package private)  void failed()
           
 long getExpiration()
           
protected  Hash getKey()
           
protected  int getLookupsRemaining()
           
 java.lang.String getName()
          Descriptive name of the task
 void runJob()
          Actually perform the task.
(package private)  void success()
           
 
Methods inherited from class net.i2p.router.JobImpl
dropped, getAddedBy, getContext, getJobId, getMadeReadyOn, getTiming, madeReady, requeue, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_log

protected Log _log

_facade

protected FloodfillNetworkDatabaseFacade _facade

_key

protected Hash _key

_onFind

protected final java.util.List<Job> _onFind

_onFailed

protected final java.util.List<Job> _onFailed

_expiration

protected long _expiration

_timeoutMs

protected int _timeoutMs

_origExpiration

protected long _origExpiration

_isLease

protected boolean _isLease

_lookupsRemaining

protected volatile int _lookupsRemaining

_dead

protected volatile boolean _dead
Constructor Detail

FloodSearchJob

public FloodSearchJob(RouterContext ctx,
                      FloodfillNetworkDatabaseFacade facade,
                      Hash key,
                      Job onFind,
                      Job onFailed,
                      int timeoutMs,
                      boolean isLease)
Method Detail

addDeferred

void addDeferred(Job onFind,
                 Job onFailed,
                 long timeoutMs,
                 boolean isLease)

getExpiration

public long getExpiration()

runJob

public void runJob()
Description copied from interface: Job
Actually perform the task. This call blocks until the Job is complete.


getName

public java.lang.String getName()
Description copied from interface: Job
Descriptive name of the task


getKey

protected Hash getKey()

decrementRemaining

protected void decrementRemaining()

getLookupsRemaining

protected int getLookupsRemaining()

failed

void failed()

success

void success()