All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.amazonaws.services.cloudwatch.AmazonCloudWatchAsyncClient Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon CloudWatch module holds the client classes that are used for communicating with Amazon CloudWatch Service

There is a newer version: 1.12.778
Show newest version
/*
 * Copyright 2019-2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
 * the License. A copy of the License is located at
 * 
 * http://aws.amazon.com/apache2.0
 * 
 * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
 * and limitations under the License.
 */
package com.amazonaws.services.cloudwatch;

import static java.util.concurrent.Executors.newFixedThreadPool;

import javax.annotation.Generated;

import com.amazonaws.services.cloudwatch.model.*;
import com.amazonaws.client.AwsAsyncClientParams;
import com.amazonaws.annotation.ThreadSafe;
import com.amazonaws.ClientConfiguration;
import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.auth.AWSCredentialsProvider;
import java.util.concurrent.ExecutorService;
import com.amazonaws.auth.DefaultAWSCredentialsProviderChain;

/**
 * Client for accessing CloudWatch asynchronously. Each asynchronous method will return a Java Future object
 * representing the asynchronous operation; overloads which accept an {@code AsyncHandler} can be used to receive
 * notification when an asynchronous operation completes.
 * 

*

* Amazon CloudWatch monitors your Amazon Web Services (Amazon Web Services) resources and the applications you run on * Amazon Web Services in real time. You can use CloudWatch to collect and track metrics, which are the variables you * want to measure for your resources and applications. *

*

* CloudWatch alarms send notifications or automatically change the resources you are monitoring based on rules that you * define. For example, you can monitor the CPU usage and disk reads and writes of your Amazon EC2 instances. Then, use * this data to determine whether you should launch additional instances to handle increased load. You can also use this * data to stop under-used instances to save money. *

*

* In addition to monitoring the built-in metrics that come with Amazon Web Services, you can monitor your own custom * metrics. With CloudWatch, you gain system-wide visibility into resource utilization, application performance, and * operational health. *

*/ @ThreadSafe @Generated("com.amazonaws:aws-java-sdk-code-generator") public class AmazonCloudWatchAsyncClient extends AmazonCloudWatchClient implements AmazonCloudWatchAsync { private static final int DEFAULT_THREAD_POOL_SIZE = 50; private final java.util.concurrent.ExecutorService executorService; /** * Constructs a new asynchronous client to invoke service methods on CloudWatch. A credentials provider chain will * be used that searches for credentials in this order: *
    *
  • Environment Variables - AWS_ACCESS_KEY_ID and AWS_SECRET_KEY
  • *
  • Java System Properties - aws.accessKeyId and aws.secretKey
  • *
  • Credential profiles file at the default location (~/.aws/credentials) shared by all AWS SDKs and the AWS CLI
  • *
  • Instance profile credentials delivered through the Amazon EC2 metadata service
  • *
*

* Asynchronous methods are delegated to a fixed-size thread pool containing 50 threads (to match the default * maximum number of concurrent connections to the service). * * @see com.amazonaws.auth.DefaultAWSCredentialsProviderChain * @see java.util.concurrent.Executors#newFixedThreadPool(int) * @deprecated use {@link AmazonCloudWatchAsyncClientBuilder#defaultClient()} */ @Deprecated public AmazonCloudWatchAsyncClient() { this(DefaultAWSCredentialsProviderChain.getInstance()); } /** * Constructs a new asynchronous client to invoke service methods on CloudWatch. A credentials provider chain will * be used that searches for credentials in this order: *

    *
  • Environment Variables - AWS_ACCESS_KEY_ID and AWS_SECRET_KEY
  • *
  • Java System Properties - aws.accessKeyId and aws.secretKey
  • *
  • Credential profiles file at the default location (~/.aws/credentials) shared by all AWS SDKs and the AWS CLI
  • *
  • Instance profile credentials delivered through the Amazon EC2 metadata service
  • *
*

* Asynchronous methods are delegated to a fixed-size thread pool containing a number of threads equal to the * maximum number of concurrent connections configured via {@code ClientConfiguration.getMaxConnections()}. * * @param clientConfiguration * The client configuration options controlling how this client connects to CloudWatch (ex: proxy settings, * retry counts, etc). * * @see com.amazonaws.auth.DefaultAWSCredentialsProviderChain * @see java.util.concurrent.Executors#newFixedThreadPool(int) * @deprecated use {@link AmazonCloudWatchAsyncClientBuilder#withClientConfiguration(ClientConfiguration)} */ @Deprecated public AmazonCloudWatchAsyncClient(ClientConfiguration clientConfiguration) { this(DefaultAWSCredentialsProviderChain.getInstance(), clientConfiguration, newFixedThreadPool(clientConfiguration.getMaxConnections())); } /** * Constructs a new asynchronous client to invoke service methods on CloudWatch using the specified AWS account * credentials. *

* Asynchronous methods are delegated to a fixed-size thread pool containing 50 threads (to match the default * maximum number of concurrent connections to the service). * * @param awsCredentials * The AWS credentials (access key ID and secret key) to use when authenticating with AWS services. * @see java.util.concurrent.Executors#newFixedThreadPool(int) * @deprecated use {@link AmazonCloudWatchAsyncClientBuilder#withCredentials(AWSCredentialsProvider)} */ @Deprecated public AmazonCloudWatchAsyncClient(AWSCredentials awsCredentials) { this(awsCredentials, newFixedThreadPool(DEFAULT_THREAD_POOL_SIZE)); } /** * Constructs a new asynchronous client to invoke service methods on CloudWatch using the specified AWS account * credentials and executor service. Default client settings will be used. * * @param awsCredentials * The AWS credentials (access key ID and secret key) to use when authenticating with AWS services. * @param executorService * The executor service by which all asynchronous requests will be executed. * @deprecated use {@link AmazonCloudWatchAsyncClientBuilder#withCredentials(AWSCredentialsProvider)} and * {@link AmazonCloudWatchAsyncClientBuilder#withExecutorFactory(com.amazonaws.client.builder.ExecutorFactory)} */ @Deprecated public AmazonCloudWatchAsyncClient(AWSCredentials awsCredentials, ExecutorService executorService) { this(awsCredentials, configFactory.getConfig(), executorService); } /** * Constructs a new asynchronous client to invoke service methods on CloudWatch using the specified AWS account * credentials, executor service, and client configuration options. * * @param awsCredentials * The AWS credentials (access key ID and secret key) to use when authenticating with AWS services. * @param clientConfiguration * Client configuration options (ex: max retry limit, proxy settings, etc). * @param executorService * The executor service by which all asynchronous requests will be executed. * @deprecated use {@link AmazonCloudWatchAsyncClientBuilder#withCredentials(AWSCredentialsProvider)} and * {@link AmazonCloudWatchAsyncClientBuilder#withClientConfiguration(ClientConfiguration)} and * {@link AmazonCloudWatchAsyncClientBuilder#withExecutorFactory(com.amazonaws.client.builder.ExecutorFactory)} */ @Deprecated public AmazonCloudWatchAsyncClient(AWSCredentials awsCredentials, ClientConfiguration clientConfiguration, ExecutorService executorService) { super(awsCredentials, clientConfiguration); this.executorService = executorService; } /** * Constructs a new asynchronous client to invoke service methods on CloudWatch using the specified AWS account * credentials provider. Default client settings will be used. *

* Asynchronous methods are delegated to a fixed-size thread pool containing 50 threads (to match the default * maximum number of concurrent connections to the service). * * @param awsCredentialsProvider * The AWS credentials provider which will provide credentials to authenticate requests with AWS services. * @see java.util.concurrent.Executors#newFixedThreadPool(int) * @deprecated use {@link AmazonCloudWatchAsyncClientBuilder#withCredentials(AWSCredentialsProvider)} */ @Deprecated public AmazonCloudWatchAsyncClient(AWSCredentialsProvider awsCredentialsProvider) { this(awsCredentialsProvider, newFixedThreadPool(DEFAULT_THREAD_POOL_SIZE)); } /** * Constructs a new asynchronous client to invoke service methods on CloudWatch using the provided AWS account * credentials provider and client configuration options. *

* Asynchronous methods are delegated to a fixed-size thread pool containing a number of threads equal to the * maximum number of concurrent connections configured via {@code ClientConfiguration.getMaxConnections()}. * * @param awsCredentialsProvider * The AWS credentials provider which will provide credentials to authenticate requests with AWS services. * @param clientConfiguration * Client configuration options (ex: max retry limit, proxy settings, etc). * * @see com.amazonaws.auth.DefaultAWSCredentialsProviderChain * @see java.util.concurrent.Executors#newFixedThreadPool(int) * @deprecated use {@link AmazonCloudWatchAsyncClientBuilder#withCredentials(AWSCredentialsProvider)} and * {@link AmazonCloudWatchAsyncClientBuilder#withClientConfiguration(ClientConfiguration)} */ @Deprecated public AmazonCloudWatchAsyncClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration) { this(awsCredentialsProvider, clientConfiguration, newFixedThreadPool(clientConfiguration.getMaxConnections())); } /** * Constructs a new asynchronous client to invoke service methods on CloudWatch using the specified AWS account * credentials provider and executor service. Default client settings will be used. * * @param awsCredentialsProvider * The AWS credentials provider which will provide credentials to authenticate requests with AWS services. * @param executorService * The executor service by which all asynchronous requests will be executed. * @deprecated use {@link AmazonCloudWatchAsyncClientBuilder#withCredentials(AWSCredentialsProvider)} and * {@link AmazonCloudWatchAsyncClientBuilder#withExecutorFactory(com.amazonaws.client.builder.ExecutorFactory)} */ @Deprecated public AmazonCloudWatchAsyncClient(AWSCredentialsProvider awsCredentialsProvider, ExecutorService executorService) { this(awsCredentialsProvider, configFactory.getConfig(), executorService); } /** * Constructs a new asynchronous client to invoke service methods on CloudWatch using the specified AWS account * credentials provider, executor service, and client configuration options. * * @param awsCredentialsProvider * The AWS credentials provider which will provide credentials to authenticate requests with AWS services. * @param clientConfiguration * Client configuration options (ex: max retry limit, proxy settings, etc). * @param executorService * The executor service by which all asynchronous requests will be executed. * @deprecated use {@link AmazonCloudWatchAsyncClientBuilder#withCredentials(AWSCredentialsProvider)} and * {@link AmazonCloudWatchAsyncClientBuilder#withClientConfiguration(ClientConfiguration)} and * {@link AmazonCloudWatchAsyncClientBuilder#withExecutorFactory(com.amazonaws.client.builder.ExecutorFactory)} */ @Deprecated public AmazonCloudWatchAsyncClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration, ExecutorService executorService) { super(awsCredentialsProvider, clientConfiguration); this.executorService = executorService; } public static AmazonCloudWatchAsyncClientBuilder asyncBuilder() { return AmazonCloudWatchAsyncClientBuilder.standard(); } /** * Constructs a new asynchronous client to invoke service methods on CloudWatch using the specified parameters. * * @param asyncClientParams * Object providing client parameters. */ AmazonCloudWatchAsyncClient(AwsAsyncClientParams asyncClientParams) { this(asyncClientParams, false); } /** * Constructs a new asynchronous client to invoke service methods on CloudWatch using the specified parameters. * * @param asyncClientParams * Object providing client parameters. * @param endpointDiscoveryEnabled * true will enable endpoint discovery if the service supports it. */ AmazonCloudWatchAsyncClient(AwsAsyncClientParams asyncClientParams, boolean endpointDiscoveryEnabled) { super(asyncClientParams, endpointDiscoveryEnabled); this.executorService = asyncClientParams.getExecutor(); } /** * Returns the executor service used by this client to execute async requests. * * @return The executor service used by this client to execute async requests. */ public ExecutorService getExecutorService() { return executorService; } @Override public java.util.concurrent.Future deleteAlarmsAsync(DeleteAlarmsRequest request) { return deleteAlarmsAsync(request, null); } @Override public java.util.concurrent.Future deleteAlarmsAsync(final DeleteAlarmsRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final DeleteAlarmsRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public DeleteAlarmsResult call() throws Exception { DeleteAlarmsResult result = null; try { result = executeDeleteAlarms(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future deleteAnomalyDetectorAsync(DeleteAnomalyDetectorRequest request) { return deleteAnomalyDetectorAsync(request, null); } @Override public java.util.concurrent.Future deleteAnomalyDetectorAsync(final DeleteAnomalyDetectorRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final DeleteAnomalyDetectorRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public DeleteAnomalyDetectorResult call() throws Exception { DeleteAnomalyDetectorResult result = null; try { result = executeDeleteAnomalyDetector(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future deleteDashboardsAsync(DeleteDashboardsRequest request) { return deleteDashboardsAsync(request, null); } @Override public java.util.concurrent.Future deleteDashboardsAsync(final DeleteDashboardsRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final DeleteDashboardsRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public DeleteDashboardsResult call() throws Exception { DeleteDashboardsResult result = null; try { result = executeDeleteDashboards(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future deleteInsightRulesAsync(DeleteInsightRulesRequest request) { return deleteInsightRulesAsync(request, null); } @Override public java.util.concurrent.Future deleteInsightRulesAsync(final DeleteInsightRulesRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final DeleteInsightRulesRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public DeleteInsightRulesResult call() throws Exception { DeleteInsightRulesResult result = null; try { result = executeDeleteInsightRules(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future deleteMetricStreamAsync(DeleteMetricStreamRequest request) { return deleteMetricStreamAsync(request, null); } @Override public java.util.concurrent.Future deleteMetricStreamAsync(final DeleteMetricStreamRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final DeleteMetricStreamRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public DeleteMetricStreamResult call() throws Exception { DeleteMetricStreamResult result = null; try { result = executeDeleteMetricStream(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future describeAlarmHistoryAsync(DescribeAlarmHistoryRequest request) { return describeAlarmHistoryAsync(request, null); } @Override public java.util.concurrent.Future describeAlarmHistoryAsync(final DescribeAlarmHistoryRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final DescribeAlarmHistoryRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public DescribeAlarmHistoryResult call() throws Exception { DescribeAlarmHistoryResult result = null; try { result = executeDescribeAlarmHistory(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } /** * Simplified method form for invoking the DescribeAlarmHistory operation. * * @see #describeAlarmHistoryAsync(DescribeAlarmHistoryRequest) */ @Override public java.util.concurrent.Future describeAlarmHistoryAsync() { return describeAlarmHistoryAsync(new DescribeAlarmHistoryRequest()); } /** * Simplified method form for invoking the DescribeAlarmHistory operation with an AsyncHandler. * * @see #describeAlarmHistoryAsync(DescribeAlarmHistoryRequest, com.amazonaws.handlers.AsyncHandler) */ @Override public java.util.concurrent.Future describeAlarmHistoryAsync( com.amazonaws.handlers.AsyncHandler asyncHandler) { return describeAlarmHistoryAsync(new DescribeAlarmHistoryRequest(), asyncHandler); } @Override public java.util.concurrent.Future describeAlarmsAsync(DescribeAlarmsRequest request) { return describeAlarmsAsync(request, null); } @Override public java.util.concurrent.Future describeAlarmsAsync(final DescribeAlarmsRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final DescribeAlarmsRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public DescribeAlarmsResult call() throws Exception { DescribeAlarmsResult result = null; try { result = executeDescribeAlarms(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } /** * Simplified method form for invoking the DescribeAlarms operation. * * @see #describeAlarmsAsync(DescribeAlarmsRequest) */ @Override public java.util.concurrent.Future describeAlarmsAsync() { return describeAlarmsAsync(new DescribeAlarmsRequest()); } /** * Simplified method form for invoking the DescribeAlarms operation with an AsyncHandler. * * @see #describeAlarmsAsync(DescribeAlarmsRequest, com.amazonaws.handlers.AsyncHandler) */ @Override public java.util.concurrent.Future describeAlarmsAsync( com.amazonaws.handlers.AsyncHandler asyncHandler) { return describeAlarmsAsync(new DescribeAlarmsRequest(), asyncHandler); } @Override public java.util.concurrent.Future describeAlarmsForMetricAsync(DescribeAlarmsForMetricRequest request) { return describeAlarmsForMetricAsync(request, null); } @Override public java.util.concurrent.Future describeAlarmsForMetricAsync(final DescribeAlarmsForMetricRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final DescribeAlarmsForMetricRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public DescribeAlarmsForMetricResult call() throws Exception { DescribeAlarmsForMetricResult result = null; try { result = executeDescribeAlarmsForMetric(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future describeAnomalyDetectorsAsync(DescribeAnomalyDetectorsRequest request) { return describeAnomalyDetectorsAsync(request, null); } @Override public java.util.concurrent.Future describeAnomalyDetectorsAsync(final DescribeAnomalyDetectorsRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final DescribeAnomalyDetectorsRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public DescribeAnomalyDetectorsResult call() throws Exception { DescribeAnomalyDetectorsResult result = null; try { result = executeDescribeAnomalyDetectors(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future describeInsightRulesAsync(DescribeInsightRulesRequest request) { return describeInsightRulesAsync(request, null); } @Override public java.util.concurrent.Future describeInsightRulesAsync(final DescribeInsightRulesRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final DescribeInsightRulesRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public DescribeInsightRulesResult call() throws Exception { DescribeInsightRulesResult result = null; try { result = executeDescribeInsightRules(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future disableAlarmActionsAsync(DisableAlarmActionsRequest request) { return disableAlarmActionsAsync(request, null); } @Override public java.util.concurrent.Future disableAlarmActionsAsync(final DisableAlarmActionsRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final DisableAlarmActionsRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public DisableAlarmActionsResult call() throws Exception { DisableAlarmActionsResult result = null; try { result = executeDisableAlarmActions(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future disableInsightRulesAsync(DisableInsightRulesRequest request) { return disableInsightRulesAsync(request, null); } @Override public java.util.concurrent.Future disableInsightRulesAsync(final DisableInsightRulesRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final DisableInsightRulesRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public DisableInsightRulesResult call() throws Exception { DisableInsightRulesResult result = null; try { result = executeDisableInsightRules(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future enableAlarmActionsAsync(EnableAlarmActionsRequest request) { return enableAlarmActionsAsync(request, null); } @Override public java.util.concurrent.Future enableAlarmActionsAsync(final EnableAlarmActionsRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final EnableAlarmActionsRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public EnableAlarmActionsResult call() throws Exception { EnableAlarmActionsResult result = null; try { result = executeEnableAlarmActions(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future enableInsightRulesAsync(EnableInsightRulesRequest request) { return enableInsightRulesAsync(request, null); } @Override public java.util.concurrent.Future enableInsightRulesAsync(final EnableInsightRulesRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final EnableInsightRulesRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public EnableInsightRulesResult call() throws Exception { EnableInsightRulesResult result = null; try { result = executeEnableInsightRules(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future getDashboardAsync(GetDashboardRequest request) { return getDashboardAsync(request, null); } @Override public java.util.concurrent.Future getDashboardAsync(final GetDashboardRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final GetDashboardRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public GetDashboardResult call() throws Exception { GetDashboardResult result = null; try { result = executeGetDashboard(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future getInsightRuleReportAsync(GetInsightRuleReportRequest request) { return getInsightRuleReportAsync(request, null); } @Override public java.util.concurrent.Future getInsightRuleReportAsync(final GetInsightRuleReportRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final GetInsightRuleReportRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public GetInsightRuleReportResult call() throws Exception { GetInsightRuleReportResult result = null; try { result = executeGetInsightRuleReport(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future getMetricDataAsync(GetMetricDataRequest request) { return getMetricDataAsync(request, null); } @Override public java.util.concurrent.Future getMetricDataAsync(final GetMetricDataRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final GetMetricDataRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public GetMetricDataResult call() throws Exception { GetMetricDataResult result = null; try { result = executeGetMetricData(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future getMetricStatisticsAsync(GetMetricStatisticsRequest request) { return getMetricStatisticsAsync(request, null); } @Override public java.util.concurrent.Future getMetricStatisticsAsync(final GetMetricStatisticsRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final GetMetricStatisticsRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public GetMetricStatisticsResult call() throws Exception { GetMetricStatisticsResult result = null; try { result = executeGetMetricStatistics(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future getMetricStreamAsync(GetMetricStreamRequest request) { return getMetricStreamAsync(request, null); } @Override public java.util.concurrent.Future getMetricStreamAsync(final GetMetricStreamRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final GetMetricStreamRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public GetMetricStreamResult call() throws Exception { GetMetricStreamResult result = null; try { result = executeGetMetricStream(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future getMetricWidgetImageAsync(GetMetricWidgetImageRequest request) { return getMetricWidgetImageAsync(request, null); } @Override public java.util.concurrent.Future getMetricWidgetImageAsync(final GetMetricWidgetImageRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final GetMetricWidgetImageRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public GetMetricWidgetImageResult call() throws Exception { GetMetricWidgetImageResult result = null; try { result = executeGetMetricWidgetImage(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future listDashboardsAsync(ListDashboardsRequest request) { return listDashboardsAsync(request, null); } @Override public java.util.concurrent.Future listDashboardsAsync(final ListDashboardsRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final ListDashboardsRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public ListDashboardsResult call() throws Exception { ListDashboardsResult result = null; try { result = executeListDashboards(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future listManagedInsightRulesAsync(ListManagedInsightRulesRequest request) { return listManagedInsightRulesAsync(request, null); } @Override public java.util.concurrent.Future listManagedInsightRulesAsync(final ListManagedInsightRulesRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final ListManagedInsightRulesRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public ListManagedInsightRulesResult call() throws Exception { ListManagedInsightRulesResult result = null; try { result = executeListManagedInsightRules(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future listMetricStreamsAsync(ListMetricStreamsRequest request) { return listMetricStreamsAsync(request, null); } @Override public java.util.concurrent.Future listMetricStreamsAsync(final ListMetricStreamsRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final ListMetricStreamsRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public ListMetricStreamsResult call() throws Exception { ListMetricStreamsResult result = null; try { result = executeListMetricStreams(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future listMetricsAsync(ListMetricsRequest request) { return listMetricsAsync(request, null); } @Override public java.util.concurrent.Future listMetricsAsync(final ListMetricsRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final ListMetricsRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public ListMetricsResult call() throws Exception { ListMetricsResult result = null; try { result = executeListMetrics(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } /** * Simplified method form for invoking the ListMetrics operation. * * @see #listMetricsAsync(ListMetricsRequest) */ @Override public java.util.concurrent.Future listMetricsAsync() { return listMetricsAsync(new ListMetricsRequest()); } /** * Simplified method form for invoking the ListMetrics operation with an AsyncHandler. * * @see #listMetricsAsync(ListMetricsRequest, com.amazonaws.handlers.AsyncHandler) */ @Override public java.util.concurrent.Future listMetricsAsync( com.amazonaws.handlers.AsyncHandler asyncHandler) { return listMetricsAsync(new ListMetricsRequest(), asyncHandler); } @Override public java.util.concurrent.Future listTagsForResourceAsync(ListTagsForResourceRequest request) { return listTagsForResourceAsync(request, null); } @Override public java.util.concurrent.Future listTagsForResourceAsync(final ListTagsForResourceRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final ListTagsForResourceRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public ListTagsForResourceResult call() throws Exception { ListTagsForResourceResult result = null; try { result = executeListTagsForResource(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future putAnomalyDetectorAsync(PutAnomalyDetectorRequest request) { return putAnomalyDetectorAsync(request, null); } @Override public java.util.concurrent.Future putAnomalyDetectorAsync(final PutAnomalyDetectorRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final PutAnomalyDetectorRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public PutAnomalyDetectorResult call() throws Exception { PutAnomalyDetectorResult result = null; try { result = executePutAnomalyDetector(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future putCompositeAlarmAsync(PutCompositeAlarmRequest request) { return putCompositeAlarmAsync(request, null); } @Override public java.util.concurrent.Future putCompositeAlarmAsync(final PutCompositeAlarmRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final PutCompositeAlarmRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public PutCompositeAlarmResult call() throws Exception { PutCompositeAlarmResult result = null; try { result = executePutCompositeAlarm(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future putDashboardAsync(PutDashboardRequest request) { return putDashboardAsync(request, null); } @Override public java.util.concurrent.Future putDashboardAsync(final PutDashboardRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final PutDashboardRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public PutDashboardResult call() throws Exception { PutDashboardResult result = null; try { result = executePutDashboard(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future putInsightRuleAsync(PutInsightRuleRequest request) { return putInsightRuleAsync(request, null); } @Override public java.util.concurrent.Future putInsightRuleAsync(final PutInsightRuleRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final PutInsightRuleRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public PutInsightRuleResult call() throws Exception { PutInsightRuleResult result = null; try { result = executePutInsightRule(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future putManagedInsightRulesAsync(PutManagedInsightRulesRequest request) { return putManagedInsightRulesAsync(request, null); } @Override public java.util.concurrent.Future putManagedInsightRulesAsync(final PutManagedInsightRulesRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final PutManagedInsightRulesRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public PutManagedInsightRulesResult call() throws Exception { PutManagedInsightRulesResult result = null; try { result = executePutManagedInsightRules(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future putMetricAlarmAsync(PutMetricAlarmRequest request) { return putMetricAlarmAsync(request, null); } @Override public java.util.concurrent.Future putMetricAlarmAsync(final PutMetricAlarmRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final PutMetricAlarmRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public PutMetricAlarmResult call() throws Exception { PutMetricAlarmResult result = null; try { result = executePutMetricAlarm(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future putMetricDataAsync(PutMetricDataRequest request) { return putMetricDataAsync(request, null); } @Override public java.util.concurrent.Future putMetricDataAsync(final PutMetricDataRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final PutMetricDataRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public PutMetricDataResult call() throws Exception { PutMetricDataResult result = null; try { result = executePutMetricData(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future putMetricStreamAsync(PutMetricStreamRequest request) { return putMetricStreamAsync(request, null); } @Override public java.util.concurrent.Future putMetricStreamAsync(final PutMetricStreamRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final PutMetricStreamRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public PutMetricStreamResult call() throws Exception { PutMetricStreamResult result = null; try { result = executePutMetricStream(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future setAlarmStateAsync(SetAlarmStateRequest request) { return setAlarmStateAsync(request, null); } @Override public java.util.concurrent.Future setAlarmStateAsync(final SetAlarmStateRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final SetAlarmStateRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public SetAlarmStateResult call() throws Exception { SetAlarmStateResult result = null; try { result = executeSetAlarmState(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future startMetricStreamsAsync(StartMetricStreamsRequest request) { return startMetricStreamsAsync(request, null); } @Override public java.util.concurrent.Future startMetricStreamsAsync(final StartMetricStreamsRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final StartMetricStreamsRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public StartMetricStreamsResult call() throws Exception { StartMetricStreamsResult result = null; try { result = executeStartMetricStreams(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future stopMetricStreamsAsync(StopMetricStreamsRequest request) { return stopMetricStreamsAsync(request, null); } @Override public java.util.concurrent.Future stopMetricStreamsAsync(final StopMetricStreamsRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final StopMetricStreamsRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public StopMetricStreamsResult call() throws Exception { StopMetricStreamsResult result = null; try { result = executeStopMetricStreams(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future tagResourceAsync(TagResourceRequest request) { return tagResourceAsync(request, null); } @Override public java.util.concurrent.Future tagResourceAsync(final TagResourceRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final TagResourceRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public TagResourceResult call() throws Exception { TagResourceResult result = null; try { result = executeTagResource(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } @Override public java.util.concurrent.Future untagResourceAsync(UntagResourceRequest request) { return untagResourceAsync(request, null); } @Override public java.util.concurrent.Future untagResourceAsync(final UntagResourceRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final UntagResourceRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public UntagResourceResult call() throws Exception { UntagResourceResult result = null; try { result = executeUntagResource(finalRequest); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(finalRequest, result); } return result; } }); } /** * Shuts down the client, releasing all managed resources. This includes forcibly terminating all pending * asynchronous service calls. Clients who wish to give pending asynchronous service calls time to complete should * call {@code getExecutorService().shutdown()} followed by {@code getExecutorService().awaitTermination()} prior to * calling this method. */ @Override public void shutdown() { super.shutdown(); executorService.shutdownNow(); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy