org.snmp4j
Class DefaultTimeoutModel

java.lang.Object
  extended by org.snmp4j.DefaultTimeoutModel
All Implemented Interfaces:
TimeoutModel

public class DefaultTimeoutModel
extends java.lang.Object
implements TimeoutModel

The DefaultTimeoutModel implements a timeout model that uses constant timeouts between retries.

The total time waited before a request is timed out is therefore: (totalNumberOfRetries + 1) * targetTimeout where each (re)try is timed out after targetTimeout milliseconds.

Version:
1.0
Author:
Frank Fock

Constructor Summary
DefaultTimeoutModel()
           
 
Method Summary
 long getRequestTimeout(int totalNumberOfRetries, long targetTimeout)
          Gets the timeout for all retries, which is defined as the sum of TimeoutModel.getRetryTimeout(int retryCount, int totalNumberOfRetries, long targetTimeout) for all retryCount in 0 <= retryCount < totalNumberOfRetries.
 long getRetryTimeout(int retryCount, int totalNumberOfRetries, long targetTimeout)
          Gets the timeout for the specified retry (a zero value for retryCount specifies the first request).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultTimeoutModel

public DefaultTimeoutModel()
Method Detail

getRetryTimeout

public long getRetryTimeout(int retryCount,
                            int totalNumberOfRetries,
                            long targetTimeout)
Description copied from interface: TimeoutModel
Gets the timeout for the specified retry (a zero value for retryCount specifies the first request).

Specified by:
getRetryTimeout in interface TimeoutModel
Parameters:
retryCount - the number of retries already performed for the target.
totalNumberOfRetries - the total number of retries configured for the target.
targetTimeout - the timeout as specified for the target in milliseconds.
Returns:
long the timeout duration in milliseconds for the supplied retry.

getRequestTimeout

public long getRequestTimeout(int totalNumberOfRetries,
                              long targetTimeout)
Description copied from interface: TimeoutModel
Gets the timeout for all retries, which is defined as the sum of TimeoutModel.getRetryTimeout(int retryCount, int totalNumberOfRetries, long targetTimeout) for all retryCount in 0 <= retryCount < totalNumberOfRetries.

Specified by:
getRequestTimeout in interface TimeoutModel
Parameters:
totalNumberOfRetries - the total number of retries configured for the target.
targetTimeout - the timeout as specified for the target in milliseconds.
Returns:
the time in milliseconds when the request will be timed out finally.

Copyright 2005-2010 Frank Fock (SNMP4J.org)

Copyright © 2011 SNMP4J.org. All Rights Reserved.