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


Java ResourceNotFoundException类代码示例

本文整理汇总了Java中com.amazonaws.services.logs.model.ResourceNotFoundException的典型用法代码示例。如果您正苦于以下问题:Java ResourceNotFoundException类的具体用法?Java ResourceNotFoundException怎么用?Java ResourceNotFoundException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: retrieveQueueAttribute

import com.amazonaws.services.logs.model.ResourceNotFoundException; //导入依赖的package包/类
/**
 *  Loops until an attribute is set, throwing after a timeout.
 */
private String retrieveQueueAttribute(String attributeName)
throws Exception
{

    for (int ii = 0 ; ii < 60 ; ii++)
    {
        try
        {
            GetQueueAttributesRequest attribsRequest = new GetQueueAttributesRequest()
                                                            .withQueueUrl(queueUrl)
                                                            .withAttributeNames(attributeName);
            GetQueueAttributesResult attribsResponse = localSQSclient.getQueueAttributes(attribsRequest);
            Map<String,String> attribs = attribsResponse.getAttributes();
            if (! StringUtil.isEmpty(attribs.get(attributeName)))
                return attribs.get(attributeName);
        }
        catch (ResourceNotFoundException ex)
        {
            // ignored; queue isn't ready
        }
        Thread.sleep(1000);
    }

    throw new IllegalStateException("unable to retrieve attribute: " + attributeName);
}
 
开发者ID:kdgregory,项目名称:log4j-aws-appenders,代码行数:29,代码来源:SNSAppenderIntegrationTest.java

示例2: removeMetricFilter

import com.amazonaws.services.logs.model.ResourceNotFoundException; //导入依赖的package包/类
@Override
public boolean removeMetricFilter(MetricFilter metricFilter) {
    log.info(String.format("Removing metric filter [%s] from log group [%s]",
            metricFilter.getMetricName(), metricFilter.getLogGroupName()));

    DeleteMetricFilterRequest request = new DeleteMetricFilterRequest()
            .withLogGroupName(metricFilter.getLogGroupName())
            .withFilterName(metricFilter.getMetricName());

    try {
        client.deleteMetricFilter(request);
        return true;
    } catch (ResourceNotFoundException e) {
        log.warn(String.format("Did not find metric filter [%s] in log group [%s]",
                metricFilter.getMetricName(), metricFilter.getLogGroupName()));
    }

    return false;
}
 
开发者ID:symphoniacloud,项目名称:lambda-monitoring,代码行数:20,代码来源:CloudwatchMetricFilterPublisher.java


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