public final class PeerTable extends Object
| Modifier and Type | Field and Description | 
|---|---|
static int | 
DEFAULT_MAXIMUM_ATTEMPTS  | 
static int | 
DEFAULT_PEER_RETRY_DELAY
Default connection retry in second.s 
 | 
static long | 
DEFAULT_REQUEST_TIMEOUT
Default request timeout in milliseconds. 
 | 
static int | 
DEFAULT_WATCHDOG_TIMEOUT
Default watchdog timeout in seconds. 
 | 
static int | 
WATCHDOG_TICK_RESOLUTION
Watchdog period in milliiseconds. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
addPeer(Peer peer)  | 
void | 
addPeer(String host,
       InetAddress addr,
       int port)  | 
int | 
getMaxRequestAttempts()
Returns the maximum number of times to retry a send. 
 | 
Peer | 
getPeer(String host)  | 
int | 
getPeerRetryDelay()
Returns the time to wait for attempting to reconnect to a failed peer. 
 | 
long | 
getRequestTimeout()
Returns the maximum time to wait for an answer to a request. 
 | 
int | 
getWatchdogTimeout()  | 
boolean | 
isAllowDynamicPeers()  | 
List<String> | 
listPeers()
Lists all known peer host names. 
 | 
void | 
scheduleReconnect(Peer peer)
Schedules a timer task to reconnect to a peer after a configured peerRetryDelay
 (specified as timer "Tc" in RFC3588). 
 | 
TimerTask | 
scheduleWatchdogTick(Peer peer)
Schedules a timer task tick to expire a watchdog timer
 (specified as timer "Tw" in RFC3539). 
 | 
void | 
setAllowDynamicPeers(boolean status)  | 
void | 
setMaxRequestAttempts(int maximum)
Sets the number of times to retry on failure. 
 | 
void | 
setPeerRetryDelay(int secs)
Sets the time to wait before attempting to reconnect to a failed peer. 
 | 
void | 
setRequestTimeout(long msec)
Sets the maximum time to wait for an answer to a request. 
 | 
void | 
setWatchdogTimeout(int secs)
Sets the watchdog timeout Tw. 
 | 
void | 
start()  | 
void | 
stop()
Stops all peers. 
 | 
public static final int DEFAULT_PEER_RETRY_DELAY
public static final long DEFAULT_REQUEST_TIMEOUT
public static final int DEFAULT_MAXIMUM_ATTEMPTS
public static final int DEFAULT_WATCHDOG_TIMEOUT
public static final int WATCHDOG_TICK_RESOLUTION
public void addPeer(Peer peer)
public void addPeer(String host, InetAddress addr, int port)
public List<String> listPeers()
public void start()
public void scheduleReconnect(Peer peer)
peer - the peer to reconnect to after the configured peerRetryDelaypublic TimerTask scheduleWatchdogTick(Peer peer)
peer - the peer to inform about Tw tickpublic void setPeerRetryDelay(int secs)
secs - the peer retry delay in secondspublic int getPeerRetryDelay()
public void setRequestTimeout(long msec)
msec - the request timeout in millisecondspublic long getRequestTimeout()
public void setMaxRequestAttempts(int maximum)
maximum - the number of times to attempt to send a request.public int getMaxRequestAttempts()
public void setWatchdogTimeout(int secs)
secs - watchdog timeout Twpublic int getWatchdogTimeout()
public void stop()
public void setAllowDynamicPeers(boolean status)
public boolean isAllowDynamicPeers()