AXL Software

com.theorem.radserver3.radutil
Class Retransmission

Object
  extended byRetransmission

public class Retransmission
extends Object

Client retransmission class.

The client should try to avoid congestion and synchronization problems by using this class to determine time outs to use when waiting for reply packets. Congestion failure occurs usually when a server is overwhelmed with requests from a large number of clients will use a short fixed timeout for retransmissions. This class will use progressively longer time outs until a maximum time out is reached. If more retries are required the Retransmission class will restart with the minimum time out.

To avoid synchronization problems that can occur when a number of clients start to synchronize their retransmissions some 'jitter' is added to the time out period so that the wait time is not measured in one second granularity.

Typically this class will be used to back off if a transmission fails and an exception is thrown. It will add extra time between retransmissions of a client packet.

This performance is based on four variables:


Field Summary
static int MAX_RETRIES
          Defauilt number of retries - 5 times.
static int MAXIMUM_TIMEOUT
          Maximum time out value - 16 seconds.
static int MINIMUM_TIMEOUT
          Default minimum time out - 2 seconds.
 
Constructor Summary
Retransmission(int minimumTimeout, int maxTimeout, int jitter, int count)
          Constructor for retransmission.
 
Method Summary
 void cancel()
          Cancel this retransmission wait.
 long getTimeout()
          Calculate the new time out based on the last time out.
static void main(String[] a)
           
 boolean pause()
          Pause between each retry.
 void reset()
          Reset the time out calculations for a fresh time out.
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_RETRIES

public static final int MAX_RETRIES
Defauilt number of retries - 5 times.

See Also:
Constant Field Values

MAXIMUM_TIMEOUT

public static final int MAXIMUM_TIMEOUT
Maximum time out value - 16 seconds.

See Also:
Constant Field Values

MINIMUM_TIMEOUT

public static final int MINIMUM_TIMEOUT
Default minimum time out - 2 seconds.

See Also:
Constant Field Values
Constructor Detail

Retransmission

public Retransmission(int minimumTimeout,
                      int maxTimeout,
                      int jitter,
                      int count)
Constructor for retransmission.

Parameters:
minimumTimeout - On a retransmission this would be the minimum time out. For example it could be 5 seconds. If the value is zero the default value is used.
maxTimeout - This is the maximum time out possible. For example it could be 60 seconds. If set to zero the default time is used.
jitter - This is the 'inaccuracy' in the actual timeout measured in percent and is applied randomly within this range. It prevents clients from all synchronizing to some exact time out like once each second. With a jitter value of 20 the first time out might occur in .8 seconds or 1.2 seconds within the range of the time out.
count - The number of retries to make. This is the number of retries beyond the initial attempt. If this value is 0 the default value is used.
Method Detail

cancel

public final void cancel()
Cancel this retransmission wait. This can only be used by another thread. An interrupt on this thread will also cancel the pause().


getTimeout

public long getTimeout()
Calculate the new time out based on the last time out.

Returns:
Time out.

main

public static void main(String[] a)

pause

public final boolean pause()
Pause between each retry. This is broken by the retry count being reached or a thread interrupt.

Returns:
true if the count is reached, false otherwise.

reset

public void reset()
Reset the time out calculations for a fresh time out.


AXL Software

Submit a bug report or feature request

Copyright 1998-2010 AXL Software PO Box 97, Viola, Delaware 19979, U.S.A. All Rights Reserved.