- java.lang.Object
-
- org.snmp4j.DefaultTimeoutModel
-
- All Implemented Interfaces:
TimeoutModel
public class DefaultTimeoutModel extends java.lang.Object implements TimeoutModel
TheDefaultTimeoutModelimplements a timeout model that uses constant timeouts between retries.The total time waited before a request is timed out is therefore:
(totalNumberOfRetries + 1) * targetTimeoutwhere each (re)try is timed out aftertargetTimeoutmilliseconds.- Version:
- 1.0
- Author:
- Frank Fock
-
-
Constructor Summary
Constructors Constructor Description DefaultTimeoutModel()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetRequestTimeout(int totalNumberOfRetries, long targetTimeout)Gets the timeout for all retries, which is defined as the sum ofTimeoutModel.getRetryTimeout(int retryCount, int totalNumberOfRetries, long targetTimeout)for allretryCountin0 &lz;= retryCount < totalNumberOfRetries.longgetRetryTimeout(int retryCount, int totalNumberOfRetries, long targetTimeout)Gets the timeout for the specified retry (a zero value forretryCountspecifies the first request).
-
-
-
Method Detail
-
getRetryTimeout
public long getRetryTimeout(int retryCount, int totalNumberOfRetries, long targetTimeout)Description copied from interface:TimeoutModelGets the timeout for the specified retry (a zero value forretryCountspecifies the first request).- Specified by:
getRetryTimeoutin interfaceTimeoutModel- 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:TimeoutModelGets the timeout for all retries, which is defined as the sum ofTimeoutModel.getRetryTimeout(int retryCount, int totalNumberOfRetries, long targetTimeout)for allretryCountin0 &lz;= retryCount < totalNumberOfRetries.- Specified by:
getRequestTimeoutin interfaceTimeoutModel- 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.
-
-