Skip to content

Commit 48aa083

Browse files
committed
Improve setNumberOfRetries comment
https://codereview.appspot.com/9690043/
1 parent 316c2d4 commit 48aa083

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,10 @@ static String executeAndGetValueOfSomeCustomHeader(HttpRequest request) {
9292
private HttpHeaders responseHeaders = new HttpHeaders();
9393

9494
/**
95-
* Set the number of retries that will be allowed to execute as the result of an
96-
* {@link HttpUnsuccessfulResponseHandler} before being terminated or {@code 0} to not retry
97-
* requests. The default value is {@code 10}.
95+
* The number of retries that will be allowed to execute before the request will be terminated or
96+
* {@code 0} to not retry requests. Retries occur as a result of either
97+
* {@link HttpUnsuccessfulResponseHandler} or {@link HttpIOExceptionHandler} which handles
98+
* abnormal HTTP response or the I/O exception.
9899
*/
99100
private int numRetries = 10;
100101

@@ -626,9 +627,11 @@ public HttpRequest setResponseInterceptor(HttpResponseInterceptor responseInterc
626627
}
627628

628629
/**
629-
* Returns the number of retries that will be allowed to execute as the result of an
630-
* {@link HttpUnsuccessfulResponseHandler} before being terminated or {@code 0} to not retry
631-
* requests.
630+
* Returns the number of retries that will be allowed to execute before the request will be
631+
* terminated or {@code 0} to not retry requests. Retries occur as a result of either
632+
* {@link HttpUnsuccessfulResponseHandler} or {@link HttpIOExceptionHandler} which handles
633+
* abnormal HTTP response or the I/O exception.
634+
*
632635
*
633636
* @since 1.5
634637
*/
@@ -637,9 +640,10 @@ public int getNumberOfRetries() {
637640
}
638641

639642
/**
640-
* Returns the number of retries that will be allowed to execute as the result of an
641-
* {@link HttpUnsuccessfulResponseHandler} before being terminated or {@code 0} to not retry
642-
* requests.
643+
* Sets the number of retries that will be allowed to execute before the request will be
644+
* terminated or {@code 0} to not retry requests. Retries occur as a result of either
645+
* {@link HttpUnsuccessfulResponseHandler} or {@link HttpIOExceptionHandler} which handles
646+
* abnormal HTTP response or the I/O exception.
643647
*
644648
* <p>
645649
* The default value is {@code 10}.
@@ -969,9 +973,8 @@ public HttpResponse execute() throws IOException {
969973
}
970974
}
971975
} catch (IOException e) {
972-
if (!retryOnExecuteIOException
973-
&& (ioExceptionHandler == null ||
974-
!ioExceptionHandler.handleIOException(this, retryRequest))) {
976+
if (!retryOnExecuteIOException && (ioExceptionHandler == null
977+
|| !ioExceptionHandler.handleIOException(this, retryRequest))) {
975978
throw e;
976979
}
977980
// Save the exception in case the retries do not work and we need to re-throw it later.

0 commit comments

Comments
 (0)