1 /*_############################################################################ 2 _## 3 _## SNMP4J - TimeoutModel.java 4 _## 5 _## Copyright 2003-2007 Frank Fock and Jochen Katz (SNMP4J.org) 6 _## 7 _## Licensed under the Apache License, Version 2.0 (the "License"); 8 _## you may not use this file except in compliance with the License. 9 _## You may obtain a copy of the License at 10 _## 11 _## http://www.apache.org/licenses/LICENSE-2.0 12 _## 13 _## Unless required by applicable law or agreed to in writing, software 14 _## distributed under the License is distributed on an "AS IS" BASIS, 15 _## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 _## See the License for the specific language governing permissions and 17 _## limitations under the License. 18 _## 19 _##########################################################################*/ 20 21 22 23 24 25 package org.snmp4j; 26 27 /** 28 * The <code>TimeoutModel</code> is the common interface for all models 29 * of timing out a SNMP request. The default model is a linear model, thus 30 * each retry has the same delay as specified by the {@link Target#getTimeout()} 31 * value. 32 * 33 * @author Frank Fock 34 * @version 1.0 35 */ 36 37 public interface TimeoutModel { 38 39 /** 40 * Gets the timeout for the specified retry (a zero value for 41 * <code>retryCount</code> specifies the first request). 42 * @param retryCount 43 * the number of retries already performed for the target. 44 * @param totalNumberOfRetries 45 * the total number of retries configured for the target. 46 * @param targetTimeout 47 * the timeout as specified for the target in milliseconds. 48 * @return long 49 * the timeout duration in milliseconds for the supplied retry. 50 */ 51 public long getRetryTimeout(int retryCount, 52 int totalNumberOfRetries, long targetTimeout); 53 54 /** 55 * Gets the timeout for all retries, which is defined as the sum of 56 * {@link #getRetryTimeout(int retryCount, int totalNumberOfRetries, 57 * long targetTimeout)} 58 * for all <code>retryCount</code> in 59 * <code>0 <= retryCount < totalNumberOfRetries</code>. 60 * 61 * @param totalNumberOfRetries 62 * the total number of retries configured for the target. 63 * @param targetTimeout 64 * the timeout as specified for the target in milliseconds. 65 * @return 66 * the time in milliseconds when the request will be timed out finally. 67 */ 68 public long getRequestTimeout(int totalNumberOfRetries, long targetTimeout); 69 } 70