@Test public void testDescribeMethodIsRetried() throws Exception { AWSEC2IOExceptionRetryHandler handler = new AWSEC2IOExceptionRetryHandler(); IOException e = new IOException("test exception"); HttpRequest request = HttpRequest.builder().method("POST").endpoint("http: HttpCommand command = new HttpCommand(request); assertTrue(handler.shouldRetryRequest(command, e)); }
@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); }
AWSEC2IOExceptionRetryHandler extends BackoffLimitedRetryHandler { @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); } }
AWSEC2IOExceptionRetryHandler extends BackoffLimitedRetryHandler { @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); }  }
AWSEC2IOExceptionRetryHandler extends BackoffLimitedRetryHandler { @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); }  @Override boolean shouldRetryRequest(HttpCommand command, IOException error); }
AWSEC2IOExceptionRetryHandler extends BackoffLimitedRetryHandler { @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); }  @Override boolean shouldRetryRequest(HttpCommand command, IOException error);  }