1 31 32 package org.apache.commons.httpclient; 33 34 41 public class DefaultMethodRetryHandler implements MethodRetryHandler { 42 43 44 private int retryCount; 45 46 47 private boolean requestSentRetryEnabled; 48 49 51 public DefaultMethodRetryHandler() { 52 this.retryCount = 3; 53 this.requestSentRetryEnabled = false; 54 } 55 56 62 public boolean retryMethod( 63 HttpMethod method, 64 HttpConnection connection, 65 HttpRecoverableException recoverableException, 66 int executionCount, 67 boolean requestSent 68 ) { 69 return ((!requestSent || requestSentRetryEnabled) && (executionCount <= retryCount)); 70 } 71 75 public boolean isRequestSentRetryEnabled() { 76 return requestSentRetryEnabled; 77 } 78 79 82 public int getRetryCount() { 83 return retryCount; 84 } 85 86 90 public void setRequestSentRetryEnabled(boolean requestSentRetryEnabled) { 91 this.requestSentRetryEnabled = requestSentRetryEnabled; 92 } 93 94 97 public void setRetryCount(int retryCount) { 98 this.retryCount = retryCount; 99 } 100 101 } 102 | Popular Tags |