本文整理汇总了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);
}
示例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;
}