Java Code Examples for org.eclipse.jetty.http.HttpStatus#REQUEST_TIMEOUT_408

The following examples show how to use org.eclipse.jetty.http.HttpStatus#REQUEST_TIMEOUT_408 . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HttpOperatorFactory.java    From digdag with Apache License 2.0 6 votes vote down vote up
private RuntimeException error(Request req, boolean uriIsSecret, Response res)
{
    if (HttpStatus.isClientError(res.getStatus())) {
        switch (res.getStatus()) {
            case HttpStatus.REQUEST_TIMEOUT_408:
            case HttpStatus.TOO_MANY_REQUESTS_429:
                // Retry these.
                return new RuntimeException("Failed HTTP request: " + requestStatus(req, res, uriIsSecret));
            default:
                // 4xx: The request is invalid for this resource. Fail hard without retrying.
                return new TaskExecutionException("HTTP 4XX Client Error: " + requestStatus(req, res, uriIsSecret));
        }
    }
    else if (res.getStatus() >= 500 && res.getStatus() < 600) {
        // 5xx: Server Error. This is hopefully ephemeral.
        return ephemeralError("HTTP 5XX Server Error: " + requestStatus(req, res, uriIsSecret));
    }
    else {
        // Unknown status code. Treat as an ephemeral error.
        return ephemeralError("Unexpected HTTP status: " + requestStatus(req, res, uriIsSecret));
    }
}
 
Example 2
Source File: Aws.java    From digdag with Apache License 2.0 5 votes vote down vote up
static boolean isDeterministicException(AmazonServiceException ex)
{
    int statusCode = ex.getStatusCode();
    switch (statusCode) {
        case HttpStatus.TOO_MANY_REQUESTS_429:
        case HttpStatus.REQUEST_TIMEOUT_408:
            return false;
        default:
            return statusCode >= 400 && statusCode < 500;
    }
}
 
Example 3
Source File: Gcp.java    From digdag with Apache License 2.0 5 votes vote down vote up
static boolean isDeterministicException(GoogleJsonResponseException e)
{
    int statusCode = e.getStatusCode();
    switch (statusCode) {
        case HttpStatus.TOO_MANY_REQUESTS_429:
        case HttpStatus.REQUEST_TIMEOUT_408:
            return false;
        default:
            return statusCode >= 400 && statusCode < 500;
    }
}
 
Example 4
Source File: TDOperator.java    From digdag with Apache License 2.0 5 votes vote down vote up
static boolean isDeterministicClientException(Exception ex)
{
    if (ex instanceof TDClientHttpException) {
        int statusCode = ((TDClientHttpException) ex).getStatusCode();
        switch (statusCode) {
            case HttpStatus.TOO_MANY_REQUESTS_429:
            case HttpStatus.REQUEST_TIMEOUT_408:
                return false;
            default:
                // return true if 4xx
                return statusCode >= 400 && statusCode < 500;
        }
    }
    else if (ex instanceof TDClientException) {
        // failed before sending HTTP request or receiving HTTP response
        TDClientException.ErrorType errorType = ((TDClientException) ex).getErrorType();
        switch (errorType) {
            case INVALID_CONFIGURATION:  // failed to read td.conf, failed to pares integer in properties set to TDClientBuilder, etc.
            case INVALID_INPUT:          // early table name validation fails, failed to format request body in json, etc.
                return true;
            default:
                // other cases such as PROXY_AUTHENTICATION_FAILURE, SSL_ERROR, REQUEST_TIMEOUT, INTERRUPTED, etc.
                break;  // pass-through
        }
    }
    return false;
}