Allow specific exception types to be retried or not retried#189
Allow specific exception types to be retried or not retried#189domesticmouse merged 3 commits intogooglemaps:masterfrom
Conversation
|
We found a Contributor License Agreement for you (the sender of this pull request) and all commit authors, but as best as we can tell these commits were authored by someone else. If that's the case, please add them to this pull request and have them confirm that they're okay with these commits being contributed to Google. If we're mistaken and you did author these commits, just reply here to confirm. |
|
The first commit is cherry-picked from #168 - if they haven't done the CLA, I can remove that commit. The other commits are authored by me. |
|
Hey @googlebot, both @amyboyd and @slukes have signed the CLA, near as I can tell. Thanks! |
|
|
||
| @Override | ||
| public <T, R extends ApiResponse<T>> PendingResult<T> handle(String hostName, String url, String userAgent, Class<R> clazz, FieldNamingPolicy fieldNamingPolicy, long errorTimeout, Integer maxRetries) { | ||
| public <T, R extends ApiResponse<T>> PendingResult<T> handle(String hostName, String url, String userAgent, Class<R> clazz, FieldNamingPolicy fieldNamingPolicy, long errorTimeout, Integer maxRetries, ExceptionsAllowedToRetry exceptionsAllowedToRetry) { |
There was a problem hiding this comment.
This looks like it exceeds the 120 char limit, can you fold it?
| public interface RequestHandler { | ||
| <T, R extends ApiResponse<T>> PendingResult<T> handle(String hostName, String url, String userAgent, Class<R> clazz, FieldNamingPolicy fieldNamingPolicy, long errorTimeout, Integer maxRetries); | ||
| <T, R extends ApiResponse<T>> PendingResult<T> handlePost(String hostName, String url, String payload, String userAgent, Class<R> clazz, FieldNamingPolicy fieldNamingPolicy, long errorTimeout, Integer maxRetries); | ||
| <T, R extends ApiResponse<T>> PendingResult<T> handle(String hostName, String url, String userAgent, Class<R> clazz, FieldNamingPolicy fieldNamingPolicy, long errorTimeout, Integer maxRetries, ExceptionsAllowedToRetry exceptionsAllowedToRetry); |
There was a problem hiding this comment.
Please check line length on these two lines.
|
|
||
| @Override | ||
| public <T, R extends ApiResponse<T>> PendingResult<T> handle(String hostName, String url, String userAgent, Class<R> clazz, FieldNamingPolicy fieldNamingPolicy, long errorTimeout, Integer maxRetries) { | ||
| public <T, R extends ApiResponse<T>> PendingResult<T> handle(String hostName, String url, String userAgent, Class<R> clazz, FieldNamingPolicy fieldNamingPolicy, long errorTimeout, Integer maxRetries, ExceptionsAllowedToRetry exceptionsAllowedToRetry) { |
There was a problem hiding this comment.
Please check line length
|
|
||
| @Override | ||
| public <T, R extends ApiResponse<T>> PendingResult<T> handlePost(String hostName, String url, String payload, String userAgent, Class<R> clazz, FieldNamingPolicy fieldNamingPolicy, long errorTimeout, Integer maxRetries) { | ||
| public <T, R extends ApiResponse<T>> PendingResult<T> handlePost(String hostName, String url, String payload, String userAgent, Class<R> clazz, FieldNamingPolicy fieldNamingPolicy, long errorTimeout, Integer maxRetries, ExceptionsAllowedToRetry exceptionsAllowedToRetry) { |
| @@ -0,0 +1,23 @@ | |||
| package com.google.maps.internal; | |||
There was a problem hiding this comment.
Please add an Apache2.0 copyright header.
842b5c6 to
b9c263d
Compare
b9c263d to
dfbb9de
Compare
PR #168 hasn't been updated in 2 months so it seems to be abandoned. This PR adds basically the same functionality - but this also allows you to customise which exceptions are retries or not.
By default only
OverQueryLimitExceptionwill be retried. If you don't want to retry after aOverQueryLimitException(maybe you are in time-sensitive situation where you want to fail fast), you can disable retries withtoggleifExceptionIsAllowedToRetry(OverQueryLimitException.class, false). The same goes for other exception types.