View Javadoc

1   /*
2    * $HeadURL: https://svn.apache.org/repos/asf/httpcomponents/oac.hc3x/trunk/src/java/org/apache/commons/httpclient/MethodRetryHandler.java $
3    * $Revision$
4    * $Date$
5    *
6    * ====================================================================
7    *
8    *  Licensed to the Apache Software Foundation (ASF) under one or more
9    *  contributor license agreements.  See the NOTICE file distributed with
10   *  this work for additional information regarding copyright ownership.
11   *  The ASF licenses this file to You under the Apache License, Version 2.0
12   *  (the "License"); you may not use this file except in compliance with
13   *  the License.  You may obtain a copy of the License at
14   *
15   *      http://www.apache.org/licenses/LICENSE-2.0
16   *
17   *  Unless required by applicable law or agreed to in writing, software
18   *  distributed under the License is distributed on an "AS IS" BASIS,
19   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20   *  See the License for the specific language governing permissions and
21   *  limitations under the License.
22   * ====================================================================
23   *
24   * This software consists of voluntary contributions made by many
25   * individuals on behalf of the Apache Software Foundation.  For more
26   * information on the Apache Software Foundation, please see
27   * <http://www.apache.org/>.
28   *
29   */
30  
31  package org.apache.commons.httpclient;
32  
33  /***
34   * A handler for determining if an HttpMethod should be retried after a 
35   * recoverable exception during execution.
36   * 
37   * @see HttpMethod#execute(HttpState, HttpConnection)
38   * @see HttpRecoverableException
39   * 
40   * @deprecated use {@link HttpMethodRetryHandler}
41   * 
42   * @author Michael Becke
43   */
44  public interface MethodRetryHandler {
45  
46      /***
47       * Determines if a method should be retried after an HttpRecoverableException
48       * occurs during execution.
49       * 
50       * @param method the method being executed
51       * @param connection the connection the method is using
52       * @param recoverableException the exception that occurred
53       * @param executionCount the number of times this method has been 
54       * unsuccessfully executed
55       * @param requestSent this argument is unused and will be removed in the future. 
56       *   {@link HttpMethod#isRequestSent()} should be used instead
57       * 
58       * @return <code>true</code> if the method should be retried, <code>false</code>
59       * otherwise
60       */
61      boolean retryMethod(
62          HttpMethod method, 
63          HttpConnection connection,
64          HttpRecoverableException recoverableException,
65          int executionCount,
66          boolean requestSent);
67  
68  }