AXL RADIUS Server API V3

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:


Constructor Summary
Retransmission(int minimumTimeout, int maxTimeout, int jitter, int count)
          Constructor.
 
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
 

Constructor Detail

Retransmission

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

Parameters:
minimumTimeout - On a retransmission this would be the minimum time out. For example it could be 5 seconds.
maxTimeout - This is the maximum time out possible. For example it could be 60 seconds.
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 first attempt.
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 RADIUS Server API V3

Submit a bug report or feature request

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