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, IterativeSearchJob

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  long _created
           
protected  boolean _dead
           
protected  long _expiration
           
protected  FloodfillNetworkDatabaseFacade _facade
           
protected  boolean _isLease
           
protected  Hash _key
           
protected  Log _log
           
protected  int _lookupsRemaining
           
protected  List<Job> _onFailed
           
protected  List<Job> _onFind
           
protected  int _timeoutMs
           
protected static int CONCURRENT_SEARCHES
           
 
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)
          Add jobs to an existing search
protected  int decrementRemaining()
          TODO AtomicInteger?
(package private)  void failed()
          Deprecated, unused, see FOSJ override
 long getCreated()
          System time, NOT context time
 long getExpiration()
          using context clock
protected  Hash getKey()
           
protected  int getLookupsRemaining()
           
 String getName()
          Deprecated, unused, see FOSJ override
 void runJob()
          Deprecated, unused, see FOSJ override
(package private)  void success()
          Deprecated, unused, see FOSJ override
 
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 final Log _log

_facade

protected final FloodfillNetworkDatabaseFacade _facade

_key

protected final Hash _key

_onFind

protected final List<Job> _onFind

_onFailed

protected final List<Job> _onFailed

_expiration

protected long _expiration

_timeoutMs

protected int _timeoutMs

_isLease

protected final boolean _isLease

_lookupsRemaining

protected volatile int _lookupsRemaining

_dead

protected volatile boolean _dead

_created

protected final long _created

CONCURRENT_SEARCHES

protected static final int CONCURRENT_SEARCHES
See Also:
Constant Field Values
Constructor Detail

FloodSearchJob

public FloodSearchJob(RouterContext ctx,
                      FloodfillNetworkDatabaseFacade facade,
                      Hash key,
                      Job onFind,
                      Job onFailed,
                      int timeoutMs,
                      boolean isLease)
Parameters:
onFind - may be null
onFailed - may be null
Method Detail

getCreated

public long getCreated()
System time, NOT context time


addDeferred

void addDeferred(Job onFind,
                 Job onFailed,
                 long timeoutMs,
                 boolean isLease)
Add jobs to an existing search

Parameters:
onFind - may be null
onFailed - may be null
timeoutMs - ignored
isLease - ignored

getExpiration

public long getExpiration()
using context clock


runJob

public void runJob()
Deprecated, unused, see FOSJ override


getName

public String getName()
Deprecated, unused, see FOSJ override


getKey

protected Hash getKey()

decrementRemaining

protected int decrementRemaining()
TODO AtomicInteger?

Returns:
number remaining after decrementing

getLookupsRemaining

protected int getLookupsRemaining()

failed

void failed()
Deprecated, unused, see FOSJ override


success

void success()
Deprecated, unused, see FOSJ override