LimeWire Consolidated API

com.limegroup.gnutella.dht
Class ActiveDHTNodeController

java.lang.Object
  extended by com.limegroup.gnutella.dht.AbstractDHTController
      extended by com.limegroup.gnutella.dht.ActiveDHTNodeController
All Implemented Interfaces:
DHTController

public class ActiveDHTNodeController
extends AbstractDHTController

Controls an active DHT node.

Active nodes load and persist DHT data, as they keep the same node ID over multiple sessions and can therefore re-use their local routing table and local database.


Field Summary
 
Fields inherited from class com.limegroup.gnutella.dht.AbstractDHTController
bootstrapper, dht, LOG
 
Method Summary
protected  MojitoDHT createMojitoDHT(Vendor vendor, Version version)
          A factory method to create MojitoDHTs
 List<IpPort> getActiveDHTNodes(int maxNodes)
          Returns maxNodes number of active Node IP:Ports
 void handleConnectionLifecycleEvent(ConnectionLifecycleEvent evt)
          A callback method to notify the DHTController about ConnectionLifecycleEvents
 void stop()
          Shuts down the DHT.
 
Methods inherited from class com.limegroup.gnutella.dht.AbstractDHTController
addActiveDHTNode, addActiveDHTNode, addContact, addPassiveDHTNode, getDHTMode, getMojitoDHT, getMRSNodes, getRouteTableVersion, isBootstrapped, isRunning, isWaitingForNodes, sendUpdatedCapabilities, start
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createMojitoDHT

protected MojitoDHT createMojitoDHT(Vendor vendor,
                                    Version version)
Description copied from class: AbstractDHTController
A factory method to create MojitoDHTs

Specified by:
createMojitoDHT in class AbstractDHTController

stop

public void stop()
Description copied from class: AbstractDHTController
Shuts down the DHT. If this is an active node, it sends the updated capabilities to its ultrapeers and stores the node's route table to a file (active.mojito). Otherwise, as a passive node, it saves a list of Most Recently Seen (MRS) nodes to bootstrap for the next session as long as there was at least two Contacts in the route table.

The persisted route table (stored contacts from the last session) is used as a secondary means to bootstrap, if the node didn't receive any hosts through the Gnutella network to bootstrap.

Specified by:
stop in interface DHTController
Overrides:
stop in class AbstractDHTController

handleConnectionLifecycleEvent

public void handleConnectionLifecycleEvent(ConnectionLifecycleEvent evt)
Description copied from interface: DHTController
A callback method to notify the DHTController about ConnectionLifecycleEvents

Specified by:
handleConnectionLifecycleEvent in interface DHTController
Overrides:
handleConnectionLifecycleEvent in class AbstractDHTController

getActiveDHTNodes

public List<IpPort> getActiveDHTNodes(int maxNodes)
Description copied from interface: DHTController
Returns maxNodes number of active Node IP:Ports

Specified by:
getActiveDHTNodes in interface DHTController
Overrides:
getActiveDHTNodes in class AbstractDHTController

LimeWire Consolidated API

Copyright © 2009. All Rights Reserved.