private static String buildMessage(HttpCommand command, HttpResponse response, Set<ErrorResponse> errors) { StringBuilder builder = new StringBuilder(); builder.append(format("command %s failed with code %s. ", command.toString(), response.getStatusCode())); for(ErrorResponse error : errors) { builder.append(format("Error [%s]: %s. ", error.getErrorCode(), error.getMessage())); } return builder.toString(); } }
private static String buildMessage(HttpCommand command, HttpResponse response, Set<ErrorResponse> errors) { StringBuilder builder = new StringBuilder(); builder.append(format("command %s failed with code %s. ", command.toString(), response.getStatusCode())); for(ErrorResponse error : errors) { builder.append(format("Error [%s]: %s. ", error.getErrorCode(), error.getMessage())); } return builder.toString(); } }
private static String buildMessage(HttpCommand command, HttpResponse response, Set<ErrorResponse> errors) { StringBuilder builder = new StringBuilder(); builder.append(format("command %s failed with code %s. ", command.toString(), response.getStatusCode())); for (ErrorResponse error : errors) { builder.append(format("Error [%s]: %s. ", error.getErrorCode(), error.getMessage())); } return builder.toString(); } }
private static String buildMessage(HttpCommand command, HttpResponse response, Set<ErrorResponse> errors) { StringBuilder builder = new StringBuilder(); builder.append(format("command %s failed with code %s. ", command.toString(), response.getStatusCode())); for (ErrorResponse error : errors) { builder.append(format("Error [%s]: %s. ", error.getErrorCode(), error.getMessage())); } return builder.toString(); } }
private static String buildMessage(HttpCommand command, HttpResponse response, Set<ErrorResponse> errors) { StringBuilder builder = new StringBuilder(); builder.append(format("command %s failed with code %s. ", command.toString(), response.getStatusCode())); for (ErrorResponse error : errors) { builder.append(format("Error [%s]: %s. ", error.getErrorCode(), error.getMessage())); } return builder.toString(); } }
public AzureStorageResponseException(HttpCommand command, HttpResponse response, AzureStorageError error) { super(String.format("command %s failed with code %s, error: %s", command.toString(), response .getStatusCode(), error.toString()), command, response); this.setError(error); }
public AzureStorageResponseException(HttpCommand command, HttpResponse response, AzureStorageError error) { super(String.format("command %s failed with code %s, error: %s", command.toString(), response .getStatusCode(), error.toString()), command, response); this.setError(error); }
public AzureStorageResponseException(HttpCommand command, HttpResponse response, AzureStorageError error) { super(String.format("command %s failed with code %s, error: %s", command.toString(), response .getStatusCode(), error.toString()), command, response); this.setError(error); }
public AzureStorageResponseException(HttpCommand command, HttpResponse response, AzureStorageError error, Throwable cause) { super(String.format("command %1$s failed with error: %2$s", command.toString(), error .toString()), command, response, cause); this.setError(error); }
public AzureStorageResponseException(HttpCommand command, HttpResponse response, AzureStorageError error) { super(String.format("command %s failed with code %s, error: %s", command.toString(), response .getStatusCode(), error.toString()), command, response); this.setError(error); }
public AzureStorageResponseException(HttpCommand command, HttpResponse response, AzureStorageError error, Throwable cause) { super(String.format("command %1$s failed with error: %2$s", command.toString(), error .toString()), command, response, cause); this.setError(error); }
public AzureStorageResponseException(HttpCommand command, HttpResponse response, AzureStorageError error, Throwable cause) { super(String.format("command %1$s failed with error: %2$s", command.toString(), error .toString()), command, response, cause); this.setError(error); }
public AzureStorageResponseException(HttpCommand command, HttpResponse response, AzureStorageError error, Throwable cause) { super(String.format("command %1$s failed with error: %2$s", command.toString(), error .toString()), command, response, cause); this.setError(error); }
public boolean shouldRetryRequest(HttpCommand command, HttpResponse response) { byte[] content = HttpUtils.closeClientButKeepContentStream(response); command.incrementFailureCount(); if (!command.isReplayable()) { logger.warn("Cannot retry after server error, command is not replayable: %1$s", command); return false; } else if (command.getFailureCount() > retryCountLimit) { logger.warn( "Cannot retry after server error, command has exceeded retry limit %1$d: %2$s", retryCountLimit, command); return false; } else if (response.getStatusCode() == 409) { // Content can be null in the case of HEAD requests if (content != null) { try { AzureStorageError error = utils.parseAzureStorageErrorFromContent(command, response, new ByteArrayInputStream(content)); if ("ContainerBeingDeleted".equals(error.getCode())) { backoffHandler.imposeBackoffExponentialDelay(100L, 3, retryCountLimit, command .getFailureCount(), command.toString()); return true; } } catch (HttpException e) { logger.warn(e, "error parsing response: %s", new String(content)); } } } return false; }
private boolean ifReplayableBackoffAndReturnTrue(HttpCommand command) { command.incrementFailureCount(); if (!command.isReplayable()) { logger.error("Cannot retry after server error, command is not replayable: %1$s", command); return false; } else if (command.getFailureCount() > retryCountLimit) { logger.error("Cannot retry after server error, command has exceeded retry limit %1$d: %2$s", retryCountLimit, command); return false; } else { imposeBackoffExponentialDelay(command.getFailureCount(), "server error: " + command.toString()); return true; } }
private boolean ifReplayableBackoffAndReturnTrue(HttpCommand command) { command.incrementFailureCount(); if (!command.isReplayable()) { logger.error("Cannot retry after server error, command is not replayable: %1$s", command); return false; } else if (command.getFailureCount() > retryCountLimit) { logger.error("Cannot retry after server error, command has exceeded retry limit %1$d: %2$s", retryCountLimit, command); return false; } else { imposeBackoffExponentialDelay(command.getFailureCount(), "server error: " + command.toString()); return true; } }
private boolean ifReplayableBackoffAndReturnTrue(HttpCommand command) { command.incrementFailureCount(); if (!command.isReplayable()) { logger.error("Cannot retry after server error, command is not replayable: %1$s", command); return false; } else if (command.getFailureCount() > retryCountLimit) { logger.error("Cannot retry after server error, command has exceeded retry limit %1$d: %2$s", retryCountLimit, command); return false; } else { imposeBackoffExponentialDelay(command.getFailureCount(), "server error: " + command.toString()); return true; } }
private boolean ifReplayableBackoffAndReturnTrue(HttpCommand command) { command.incrementFailureCount(); if (!command.isReplayable()) { logger.error("Cannot retry after server error, command is not replayable: %1$s", command); return false; } else if (command.getFailureCount() > retryCountLimit) { logger.error("Cannot retry after server error, command has exceeded retry limit %1$d: %2$s", retryCountLimit, command); return false; } else { imposeBackoffExponentialDelay(command.getFailureCount(), "server error: " + command.toString()); return true; } }
private boolean ifReplayableBackoffAndReturnTrue(HttpCommand command) { command.incrementFailureCount(); if (!command.isReplayable()) { logger.error("Cannot retry after server error, command is not replayable: %1$s", command); return false; } else if (command.getFailureCount() > retryCountLimit) { logger.error("Cannot retry after server error, command has exceeded retry limit %1$d: %2$s", retryCountLimit, command); return false; } else { imposeBackoffExponentialDelay(command.getFailureCount(), "server error: " + command.toString()); return true; } }
private boolean ifReplayableBackoffAndReturnTrue(HttpCommand command) { command.incrementFailureCount(); if (!command.isReplayable()) { logger.error("Cannot retry after server error, command is not replayable: %1$s", command); return false; } else if (command.getFailureCount() > retryCountLimit) { logger.error("Cannot retry after server error, command has exceeded retry limit %1$d: %2$s", retryCountLimit, command); return false; } else { imposeBackoffExponentialDelay(command.getFailureCount(), "server error: " + command.toString()); return true; } }