当前位置: 首页>>代码示例>>Java>>正文


Java HttpStatus.TOO_MANY_REQUESTS_429属性代码示例

本文整理汇总了Java中org.eclipse.jetty.http.HttpStatus.TOO_MANY_REQUESTS_429属性的典型用法代码示例。如果您正苦于以下问题:Java HttpStatus.TOO_MANY_REQUESTS_429属性的具体用法?Java HttpStatus.TOO_MANY_REQUESTS_429怎么用?Java HttpStatus.TOO_MANY_REQUESTS_429使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.eclipse.jetty.http.HttpStatus的用法示例。


在下文中一共展示了HttpStatus.TOO_MANY_REQUESTS_429属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: error

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));
    }
}
 
开发者ID:treasure-data,项目名称:digdag,代码行数:22,代码来源:HttpOperatorFactory.java

示例2: isDeterministicException

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;
    }
}
 
开发者ID:gymxxx,项目名称:digdag-bq-wait,代码行数:11,代码来源:Gcp.java

示例3: isDeterministicException

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;
    }
}
 
开发者ID:treasure-data,项目名称:digdag,代码行数:11,代码来源:Aws.java

示例4: isDeterministicClientException

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;
}
 
开发者ID:treasure-data,项目名称:digdag,代码行数:27,代码来源:TDOperator.java


注:本文中的org.eclipse.jetty.http.HttpStatus.TOO_MANY_REQUESTS_429属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。