10000 HttpRequest: expose the default number of retries as a constant · khggang/google-http-java-client@fb9ad07 · GitHub
[go: up one dir, main page]

Skip to content

Commit fb9ad07

Browse files
dhalperiejona86
authored andcommitted
HttpRequest: expose the default number of retries as a constant
So that others can test against it. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=110725223
1 parent b36768f commit fb9ad07

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,15 @@ public final class HttpRequest {
6464
*/
6565
public static final String USER_AGENT_SUFFIX = "Google-HTTP-Java-Client/" + VERSION + " (gzip)";
6666

67+
/**
68+
* The default number of retries that will be allowed to execute before the request will be
69+
* terminated.
70+
*
71+
* @see #getNumberOfRetries
72+
* @since 1.22
73+
*/
74+
public static final int DEFAULT_NUMBER_OF_RETRIES = 10;
75+
6776
/**
6877
* HTTP request execute interceptor to intercept the start of {@link #execute()} (before executing
6978
* the HTTP request) or {@code null} for none.
@@ -98,7 +107,7 @@ static String executeAndGetValueOfSomeCustomHeader(HttpRequest request) {
98107
* {@link HttpUnsuccessfulResponseHandler} or {@link HttpIOExceptionHandler} which handles
99108
* abnormal HTTP response or the I/O exception.
100109
*/
101-
private int numRetries = 10;
110+
private int numRetries = DEFAULT_NUMBER_OF_RETRIES;
102111

103112
/**
104113
* Determines the limit to the content size that will be logged during {@link #execute()}.
@@ -647,7 +656,7 @@ public int getNumberOfRetries() {
647656
* abnormal HTTP response or the I/O exception.
648657
*
649658
* <p>
650-
* The default value is {@code 10}.
659+
* The default value is {@link #DEFAULT_NUMBER_OF_RETRIES}.
651660
* </p>
652661
*
653662
* @since 1.5

0 commit comments

Comments
 (0)
0