private static void addRetryInfo(RetryInfo retryInfo, Set<RetryInfo> dest) { for (RetryInfo current : dest) { if (current.exception.isAssignableFrom(retryInfo.exception)) { addRetryInfo(retryInfo, current.children); return; } if (retryInfo.exception.isAssignableFrom(current.exception)) { retryInfo.children.add(current); } } dest.removeAll(retryInfo.children); dest.add(retryInfo); }
private ExceptionHandler(Builder builder) { interceptors = builder.interceptors.build(); retriableExceptions = builder.retriableExceptions.build(); nonRetriableExceptions = builder.nonRetriableExceptions.build(); Preconditions.checkArgument( Sets.intersection(retriableExceptions, nonRetriableExceptions).isEmpty(), "Same exception was found in both retryable and non-retryable sets"); for (Class<? extends Exception> exception : retriableExceptions) { addRetryInfo(new RetryInfo(exception, Interceptor.RetryResult.RETRY), retryInfo); } for (Class<? extends Exception> exception : nonRetriableExceptions) { addRetryInfo(new RetryInfo(exception, Interceptor.RetryResult.NO_RETRY), retryInfo); } }
private static void addRetryInfo(RetryInfo retryInfo, Set<RetryInfo> dest) { for (RetryInfo current : dest) { if (current.exception.isAssignableFrom(retryInfo.exception)) { addRetryInfo(retryInfo, current.children); return; } if (retryInfo.exception.isAssignableFrom(current.exception)) { retryInfo.children.add(current); } } dest.removeAll(retryInfo.children); dest.add(retryInfo); }
private static void addRetryInfo(RetryInfo retryInfo, Set<RetryInfo> dest) { for (RetryInfo current : dest) { if (current.exception.isAssignableFrom(retryInfo.exception)) { addRetryInfo(retryInfo, current.children); return; } if (retryInfo.exception.isAssignableFrom(current.exception)) { retryInfo.children.add(current); } } dest.removeAll(retryInfo.children); dest.add(retryInfo); }
private ExceptionHandler(Builder builder) { interceptors = builder.interceptors.build(); retriableExceptions = builder.retriableExceptions.build(); nonRetriableExceptions = builder.nonRetriableExceptions.build(); Preconditions.checkArgument( Sets.intersection(retriableExceptions, nonRetriableExceptions).isEmpty(), "Same exception was found in both retryable and non-retryable sets"); for (Class<? extends Exception> exception : retriableExceptions) { addRetryInfo(new RetryInfo(exception, Interceptor.RetryResult.RETRY), retryInfo); } for (Class<? extends Exception> exception : nonRetriableExceptions) { addRetryInfo(new RetryInfo(exception, Interceptor.RetryResult.NO_RETRY), retryInfo); } }
private ExceptionHandler(Builder builder) { interceptors = builder.interceptors.build(); retriableExceptions = builder.retriableExceptions.build(); nonRetriableExceptions = builder.nonRetriableExceptions.build(); Preconditions.checkArgument( Sets.intersection(retriableExceptions, nonRetriableExceptions).isEmpty(), "Same exception was found in both retryable and non-retryable sets"); for (Class<? extends Exception> exception : retriableExceptions) { addRetryInfo(new RetryInfo(exception, Interceptor.RetryResult.RETRY), retryInfo); } for (Class<? extends Exception> exception : nonRetriableExceptions) { addRetryInfo(new RetryInfo(exception, Interceptor.RetryResult.NO_RETRY), retryInfo); } }