|
8 | 8 | import com.google.common.collect.ImmutableList; |
9 | 9 | import com.google.common.collect.ImmutableSet; |
10 | 10 | import com.google.common.collect.Sets; |
| 11 | +import com.google.gcloud.ExceptionHandler.Interceptor.RetryResult; |
11 | 12 |
|
12 | 13 | import java.io.Serializable; |
13 | 14 | import java.lang.reflect.Method; |
@@ -139,10 +140,10 @@ static final class RetryInfo implements Serializable { |
139 | 140 |
|
140 | 141 | private static final long serialVersionUID = -4264634837841455974L; |
141 | 142 | private final Class<? extends Exception> exception; |
142 | | - private final Interceptor.RetryResult retry; |
| 143 | + private final RetryResult retry; |
143 | 144 | private final Set<RetryInfo> children = Sets.newHashSet(); |
144 | 145 |
|
145 | | - RetryInfo(Class<? extends Exception> exception, Interceptor.RetryResult retry) { |
| 146 | + RetryInfo(Class<? extends Exception> exception, RetryResult retry) { |
146 | 147 | this.exception = checkNotNull(exception); |
147 | 148 | this.retry = retry; |
148 | 149 | } |
@@ -173,10 +174,10 @@ private ExceptionHandler(Builder builder) { |
173 | 174 | Sets.intersection(retriableExceptions, nonRetriableExceptions).isEmpty(), |
174 | 175 | "Same exception was found in both retriable and non-retriable sets"); |
175 | 176 | for (Class<? extends Exception> exception : retriableExceptions) { |
176 | | - addToRetryInfos(retryInfos, new RetryInfo(exception, Interceptor.RetryResult.RETRY)); |
| 177 | + addToRetryInfos(retryInfos, new RetryInfo(exception, RetryResult.RETRY)); |
177 | 178 | } |
178 | 179 | for (Class<? extends Exception> exception : nonRetriableExceptions) { |
179 | | - addToRetryInfos(retryInfos, new RetryInfo(exception, Interceptor.RetryResult.ABORT)); |
| 180 | + addToRetryInfos(retryInfos, new RetryInfo(exception, RetryResult.ABORT)); |
180 | 181 | } |
181 | 182 | } |
182 | 183 |
|
@@ -241,14 +242,13 @@ public Set<Class<? extends Exception>> getNonRetriableExceptions() { |
241 | 242 |
|
242 | 243 | boolean shouldRetry(Exception ex) { |
243 | 244 | for (Interceptor interceptor : interceptors) { |
244 | | - Interceptor.RetryResult retryResult = interceptor.shouldRetry(ex); |
| 245 | + RetryResult retryResult = interceptor.shouldRetry(ex); |
245 | 246 | if (retryResult != null) { |
246 | 247 | return retryResult.booleanValue(); |
247 | 248 | } |
248 | 249 | } |
249 | 250 | RetryInfo retryInfo = findMostSpecificRetryInfo(retryInfos, ex.getClass()); |
250 | | - Interceptor.RetryResult retryResult = |
251 | | - retryInfo == null ? Interceptor.RetryResult.ABORT : retryInfo.retry; |
| 251 | + RetryResult retryResult = retryInfo == null ? RetryResult.ABORT : retryInfo.retry; |
252 | 252 | for (Interceptor interceptor : interceptors) { |
253 | 253 | retryResult = firstNonNull(interceptor.shouldRetry(ex, retryResult), retryResult); |
254 | 254 | } |
|
0 commit comments