@Override public boolean shouldRetryRequest(HttpCommand command, HttpResponse response) { if (response.getStatusCode() == TOO_MANY_REQUESTS) { return backoffHandler.shouldRetryRequest(command, response); } else { return false; } } }
protected boolean shouldRetryRequestOnError(HttpCommand command, HttpResponse response, AWSError error) { if (retryableCodes.contains(error.getCode())) return backoffLimitedRetryHandler.shouldRetryRequest(command, response); return false; }
protected boolean shouldRetryRequestOnError(HttpCommand command, HttpResponse response, AWSError error) { if (retryableCodes.contains(error.getCode())) return backoffLimitedRetryHandler.shouldRetryRequest(command, response); return false; }
protected boolean shouldRetryRequestOnError(HttpCommand command, HttpResponse response, AWSError error) { if (retryableCodes.contains(error.getCode())) return backoffLimitedRetryHandler.shouldRetryRequest(command, response); return false; }
protected boolean shouldRetryRequestOnError(HttpCommand command, HttpResponse response, AWSError error) { if (retryableCodes.contains(error.getCode())) return backoffLimitedRetryHandler.shouldRetryRequest(command, response); return false; }
protected boolean shouldRetryRequestOnError(HttpCommand command, HttpResponse response, AWSError error) { if (retryableCodes.contains(error.getCode())) return backoffLimitedRetryHandler.shouldRetryRequest(command, response); return false; }
protected boolean shouldRetryRequestOnError(HttpCommand command, HttpResponse response, AWSError error) { if (retryableServerCodes.contains(error.getCode())) return super.shouldRetryRequest(command, response); return false; }
protected boolean shouldRetryRequestOnError(HttpCommand command, HttpResponse response, AWSError error) { if (retryableCodes.contains(error.getCode())) return backoffLimitedRetryHandler.shouldRetryRequest(command, response); return false; }
protected boolean shouldRetryRequestOnError(HttpCommand command, HttpResponse response, AWSError error) { if (retryableServerCodes.contains(error.getCode())) return super.shouldRetryRequest(command, response); return false; }
@Override public boolean shouldRetryRequest(HttpCommand command, HttpResponse response) { try { switch (response.getStatusCode()) { case 401: authenticationResponseCache.invalidateAll(); return super.shouldRetryRequest(command, response); } return false; } finally { releasePayload(response); } }
protected boolean shouldRetryRequestOnError(HttpCommand command, HttpResponse response, AWSError error) { if (retryableServerCodes.contains(error.getCode())) return super.shouldRetryRequest(command, response); return false; }
protected boolean shouldRetryRequestOnError(HttpCommand command, HttpResponse response, AWSError error) { if (retryableCodes.contains(error.getCode())) return backoffLimitedRetryHandler.shouldRetryRequest(command, response); return false; }
protected boolean shouldRetryRequestOnError(HttpCommand command, HttpResponse response, AWSError error) { if (retryableServerCodes.contains(error.getCode())) return super.shouldRetryRequest(command, response); return false; }
protected boolean shouldRetryRequestOnError(HttpCommand command, HttpResponse response, AWSError error) { if (retryableCodes.contains(error.getCode())) return backoffLimitedRetryHandler.shouldRetryRequest(command, response); return false; }
protected boolean shouldRetryRequestOnError(HttpCommand command, HttpResponse response, AWSError error) { if (retryableServerCodes.contains(error.getCode())) return super.shouldRetryRequest(command, response); return false; }
@Test void testDisallowsExcessiveRetries() throws InterruptedException, IOException, SecurityException, NoSuchMethodException { HttpCommand command = createCommand(); HttpResponse response = HttpResponse.builder().statusCode(400).build(); assertEquals(handler.shouldRetryRequest(command, response), true); // Failure 1 assertEquals(handler.shouldRetryRequest(command, response), true); // Failure 2 assertEquals(handler.shouldRetryRequest(command, response), true); // Failure 3 assertEquals(handler.shouldRetryRequest(command, response), true); // Failure 4 assertEquals(handler.shouldRetryRequest(command, response), true); // Failure 5 assertEquals(handler.shouldRetryRequest(command, response), false); // Failure 6 }
@Test void testDisallowsExcessiveRetries() throws InterruptedException, IOException, SecurityException, NoSuchMethodException { HttpCommand command = createCommand(); HttpResponse response = HttpResponse.builder().statusCode(400).build(); assertEquals(handler.shouldRetryRequest(command, response), true); // Failure 1 assertEquals(handler.shouldRetryRequest(command, response), true); // Failure 2 assertEquals(handler.shouldRetryRequest(command, response), true); // Failure 3 assertEquals(handler.shouldRetryRequest(command, response), true); // Failure 4 assertEquals(handler.shouldRetryRequest(command, response), true); // Failure 5 assertEquals(handler.shouldRetryRequest(command, response), false); // Failure 6 }
@Override public boolean shouldRetryRequest(HttpCommand command, IOException error) { HttpRequest request = command.getCurrentRequest(); if ("POST".equals(request.getMethod())) { Payload payload = request.getPayload(); if (!payload.getRawContent().toString().contains(DESCRIBE_ACTION)){ logger.error("Command not considered safe to retry because request method is POST and action may not be idempotent: %1$s", command); return false; } } return super.shouldRetryRequest(command, error); }
@Test void testIncrementsFailureCount() throws InterruptedException, IOException, SecurityException, NoSuchMethodException { HttpCommand command = createCommand(); HttpResponse response = HttpResponse.builder().statusCode(400).build(); handler.shouldRetryRequest(command, response); assertEquals(command.getFailureCount(), 1); handler.shouldRetryRequest(command, response); assertEquals(command.getFailureCount(), 2); handler.shouldRetryRequest(command, response); assertEquals(command.getFailureCount(), 3); }
@Test void testIncrementsFailureCount() throws InterruptedException, IOException, SecurityException, NoSuchMethodException { HttpCommand command = createCommand(); HttpResponse response = HttpResponse.builder().statusCode(400).build(); handler.shouldRetryRequest(command, response); assertEquals(command.getFailureCount(), 1); handler.shouldRetryRequest(command, response); assertEquals(command.getFailureCount(), 2); handler.shouldRetryRequest(command, response); assertEquals(command.getFailureCount(), 3); }