com.limegroup.gnutella
Class Pinger

java.lang.Object
  extended bycom.limegroup.gnutella.Pinger
All Implemented Interfaces:
java.lang.Runnable

public final class Pinger
extends java.lang.Object
implements java.lang.Runnable

This class continually sends broadcast pings on behalf of an Ultrapeer to update the host caches of both itself and its leaves. This class reduces overall ping and pong traffic because it allows us not to forward pings received from other hosts. Instead, we use pong caching to respond to those pings with cached pongs, and send pings periodically in this class to obtain fresh host data.


Field Summary
static int PING_INTERVAL
          Constant for the number of milliseconds to wait between ping broadcasts.
 
Method Summary
static Pinger instance()
          Returns the single Pinger instance.
 void run()
          Implements the Runnable interface.
 void start()
          Starts the thread that continually sends broadcast pings on behalf of this node if it's an Ultrapeer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PING_INTERVAL

public static final int PING_INTERVAL
Constant for the number of milliseconds to wait between ping broadcasts. Public to make testing easier.

See Also:
Constant Field Values
Method Detail

instance

public static Pinger instance()
Returns the single Pinger instance.


start

public void start()
Starts the thread that continually sends broadcast pings on behalf of this node if it's an Ultrapeer.


run

public void run()
Implements the Runnable interface. Periodically sends broadcast pings along all connections.

Specified by:
run in interface java.lang.Runnable