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

com.amazonaws.services.ecs.AmazonECSAsyncClient Maven / Gradle / Ivy

/*
 * Copyright 2012-2017 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.ecs;

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

import javax.annotation.Generated;

import com.amazonaws.services.ecs.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 Amazon ECS 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 EC2 Container Service (Amazon ECS) is a highly scalable, fast, container management service that makes it easy * to run, stop, and manage Docker containers on a cluster of EC2 instances. Amazon ECS lets you launch and stop * container-enabled applications with simple API calls, allows you to get the state of your cluster from a centralized * service, and gives you access to many familiar Amazon EC2 features like security groups, Amazon EBS volumes, and IAM * roles. *

*

* You can use Amazon ECS to schedule the placement of containers across your cluster based on your resource needs, * isolation policies, and availability requirements. Amazon EC2 Container Service eliminates the need for you to * operate your own cluster management and configuration management systems or worry about scaling your management * infrastructure. *

*/ @ThreadSafe @Generated("com.amazonaws:aws-java-sdk-code-generator") public class AmazonECSAsyncClient extends AmazonECSClient implements AmazonECSAsync { 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 Amazon ECS. 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 AmazonECSAsyncClientBuilder#defaultClient()} */ @Deprecated public AmazonECSAsyncClient() { this(DefaultAWSCredentialsProviderChain.getInstance()); } /** * Constructs a new asynchronous client to invoke service methods on Amazon ECS. 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 Amazon ECS (ex: proxy settings, * retry counts, etc). * * @see com.amazonaws.auth.DefaultAWSCredentialsProviderChain * @see java.util.concurrent.Executors#newFixedThreadPool(int) * @deprecated use {@link AmazonECSAsyncClientBuilder#withClientConfiguration(ClientConfiguration)} */ @Deprecated public AmazonECSAsyncClient(ClientConfiguration clientConfiguration) { this(DefaultAWSCredentialsProviderChain.getInstance(), clientConfiguration, newFixedThreadPool(clientConfiguration.getMaxConnections())); } /** * Constructs a new asynchronous client to invoke service methods on Amazon ECS 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 AmazonECSAsyncClientBuilder#withCredentials(AWSCredentialsProvider)} */ @Deprecated public AmazonECSAsyncClient(AWSCredentials awsCredentials) { this(awsCredentials, newFixedThreadPool(DEFAULT_THREAD_POOL_SIZE)); } /** * Constructs a new asynchronous client to invoke service methods on Amazon ECS 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 AmazonECSAsyncClientBuilder#withCredentials(AWSCredentialsProvider)} and * {@link AmazonECSAsyncClientBuilder#withExecutorFactory(com.amazonaws.client.builder.ExecutorFactory)} */ @Deprecated public AmazonECSAsyncClient(AWSCredentials awsCredentials, ExecutorService executorService) { this(awsCredentials, configFactory.getConfig(), executorService); } /** * Constructs a new asynchronous client to invoke service methods on Amazon ECS 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 AmazonECSAsyncClientBuilder#withCredentials(AWSCredentialsProvider)} and * {@link AmazonECSAsyncClientBuilder#withClientConfiguration(ClientConfiguration)} and * {@link AmazonECSAsyncClientBuilder#withExecutorFactory(com.amazonaws.client.builder.ExecutorFactory)} */ @Deprecated public AmazonECSAsyncClient(AWSCredentials awsCredentials, ClientConfiguration clientConfiguration, ExecutorService executorService) { super(awsCredentials, clientConfiguration); this.executorService = executorService; } /** * Constructs a new asynchronous client to invoke service methods on Amazon ECS 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 AmazonECSAsyncClientBuilder#withCredentials(AWSCredentialsProvider)} */ @Deprecated public AmazonECSAsyncClient(AWSCredentialsProvider awsCredentialsProvider) { this(awsCredentialsProvider, newFixedThreadPool(DEFAULT_THREAD_POOL_SIZE)); } /** * Constructs a new asynchronous client to invoke service methods on Amazon ECS 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 AmazonECSAsyncClientBuilder#withCredentials(AWSCredentialsProvider)} and * {@link AmazonECSAsyncClientBuilder#withClientConfiguration(ClientConfiguration)} */ @Deprecated public AmazonECSAsyncClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration) { this(awsCredentialsProvider, clientConfiguration, newFixedThreadPool(clientConfiguration.getMaxConnections())); } /** * Constructs a new asynchronous client to invoke service methods on Amazon ECS 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 AmazonECSAsyncClientBuilder#withCredentials(AWSCredentialsProvider)} and * {@link AmazonECSAsyncClientBuilder#withExecutorFactory(com.amazonaws.client.builder.ExecutorFactory)} */ @Deprecated public AmazonECSAsyncClient(AWSCredentialsProvider awsCredentialsProvider, ExecutorService executorService) { this(awsCredentialsProvider, configFactory.getConfig(), executorService); } /** * Constructs a new asynchronous client to invoke service methods on Amazon ECS 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 AmazonECSAsyncClientBuilder#withCredentials(AWSCredentialsProvider)} and * {@link AmazonECSAsyncClientBuilder#withClientConfiguration(ClientConfiguration)} and * {@link AmazonECSAsyncClientBuilder#withExecutorFactory(com.amazonaws.client.builder.ExecutorFactory)} */ @Deprecated public AmazonECSAsyncClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration, ExecutorService executorService) { super(awsCredentialsProvider, clientConfiguration); this.executorService = executorService; } public static AmazonECSAsyncClientBuilder asyncBuilder() { return AmazonECSAsyncClientBuilder.standard(); } /** * Constructs a new asynchronous client to invoke service methods on Amazon ECS using the specified parameters. * * @param asyncClientParams * Object providing client parameters. */ AmazonECSAsyncClient(AwsAsyncClientParams asyncClientParams) { super(asyncClientParams); 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 createClusterAsync(CreateClusterRequest request) { return createClusterAsync(request, null); } @Override public java.util.concurrent.Future createClusterAsync(final CreateClusterRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final CreateClusterRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public CreateClusterResult call() throws Exception { CreateClusterResult result = null; try { result = executeCreateCluster(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 CreateCluster operation. * * @see #createClusterAsync(CreateClusterRequest) */ @Override public java.util.concurrent.Future createClusterAsync() { return createClusterAsync(new CreateClusterRequest()); } /** * Simplified method form for invoking the CreateCluster operation with an AsyncHandler. * * @see #createClusterAsync(CreateClusterRequest, com.amazonaws.handlers.AsyncHandler) */ @Override public java.util.concurrent.Future createClusterAsync( com.amazonaws.handlers.AsyncHandler asyncHandler) { return createClusterAsync(new CreateClusterRequest(), asyncHandler); } @Override public java.util.concurrent.Future createServiceAsync(CreateServiceRequest request) { return createServiceAsync(request, null); } @Override public java.util.concurrent.Future createServiceAsync(final CreateServiceRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final CreateServiceRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public CreateServiceResult call() throws Exception { CreateServiceResult result = null; try { result = executeCreateService(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 deleteAttributesAsync(DeleteAttributesRequest request) { return deleteAttributesAsync(request, null); } @Override public java.util.concurrent.Future deleteAttributesAsync(final DeleteAttributesRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final DeleteAttributesRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public DeleteAttributesResult call() throws Exception { DeleteAttributesResult result = null; try { result = executeDeleteAttributes(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 deleteClusterAsync(DeleteClusterRequest request) { return deleteClusterAsync(request, null); } @Override public java.util.concurrent.Future deleteClusterAsync(final DeleteClusterRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final DeleteClusterRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public DeleteClusterResult call() throws Exception { DeleteClusterResult result = null; try { result = executeDeleteCluster(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 deleteServiceAsync(DeleteServiceRequest request) { return deleteServiceAsync(request, null); } @Override public java.util.concurrent.Future deleteServiceAsync(final DeleteServiceRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final DeleteServiceRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public DeleteServiceResult call() throws Exception { DeleteServiceResult result = null; try { result = executeDeleteService(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 deregisterContainerInstanceAsync(DeregisterContainerInstanceRequest request) { return deregisterContainerInstanceAsync(request, null); } @Override public java.util.concurrent.Future deregisterContainerInstanceAsync(final DeregisterContainerInstanceRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final DeregisterContainerInstanceRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public DeregisterContainerInstanceResult call() throws Exception { DeregisterContainerInstanceResult result = null; try { result = executeDeregisterContainerInstance(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 deregisterTaskDefinitionAsync(DeregisterTaskDefinitionRequest request) { return deregisterTaskDefinitionAsync(request, null); } @Override public java.util.concurrent.Future deregisterTaskDefinitionAsync(final DeregisterTaskDefinitionRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final DeregisterTaskDefinitionRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public DeregisterTaskDefinitionResult call() throws Exception { DeregisterTaskDefinitionResult result = null; try { result = executeDeregisterTaskDefinition(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 describeClustersAsync(DescribeClustersRequest request) { return describeClustersAsync(request, null); } @Override public java.util.concurrent.Future describeClustersAsync(final DescribeClustersRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final DescribeClustersRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public DescribeClustersResult call() throws Exception { DescribeClustersResult result = null; try { result = executeDescribeClusters(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 DescribeClusters operation. * * @see #describeClustersAsync(DescribeClustersRequest) */ @Override public java.util.concurrent.Future describeClustersAsync() { return describeClustersAsync(new DescribeClustersRequest()); } /** * Simplified method form for invoking the DescribeClusters operation with an AsyncHandler. * * @see #describeClustersAsync(DescribeClustersRequest, com.amazonaws.handlers.AsyncHandler) */ @Override public java.util.concurrent.Future describeClustersAsync( com.amazonaws.handlers.AsyncHandler asyncHandler) { return describeClustersAsync(new DescribeClustersRequest(), asyncHandler); } @Override public java.util.concurrent.Future describeContainerInstancesAsync(DescribeContainerInstancesRequest request) { return describeContainerInstancesAsync(request, null); } @Override public java.util.concurrent.Future describeContainerInstancesAsync(final DescribeContainerInstancesRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final DescribeContainerInstancesRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public DescribeContainerInstancesResult call() throws Exception { DescribeContainerInstancesResult result = null; try { result = executeDescribeContainerInstances(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 describeServicesAsync(DescribeServicesRequest request) { return describeServicesAsync(request, null); } @Override public java.util.concurrent.Future describeServicesAsync(final DescribeServicesRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final DescribeServicesRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public DescribeServicesResult call() throws Exception { DescribeServicesResult result = null; try { result = executeDescribeServices(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 describeTaskDefinitionAsync(DescribeTaskDefinitionRequest request) { return describeTaskDefinitionAsync(request, null); } @Override public java.util.concurrent.Future describeTaskDefinitionAsync(final DescribeTaskDefinitionRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final DescribeTaskDefinitionRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public DescribeTaskDefinitionResult call() throws Exception { DescribeTaskDefinitionResult result = null; try { result = executeDescribeTaskDefinition(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 describeTasksAsync(DescribeTasksRequest request) { return describeTasksAsync(request, null); } @Override public java.util.concurrent.Future describeTasksAsync(final DescribeTasksRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final DescribeTasksRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public DescribeTasksResult call() throws Exception { DescribeTasksResult result = null; try { result = executeDescribeTasks(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 discoverPollEndpointAsync(DiscoverPollEndpointRequest request) { return discoverPollEndpointAsync(request, null); } @Override public java.util.concurrent.Future discoverPollEndpointAsync(final DiscoverPollEndpointRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final DiscoverPollEndpointRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public DiscoverPollEndpointResult call() throws Exception { DiscoverPollEndpointResult result = null; try { result = executeDiscoverPollEndpoint(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 DiscoverPollEndpoint operation. * * @see #discoverPollEndpointAsync(DiscoverPollEndpointRequest) */ @Override public java.util.concurrent.Future discoverPollEndpointAsync() { return discoverPollEndpointAsync(new DiscoverPollEndpointRequest()); } /** * Simplified method form for invoking the DiscoverPollEndpoint operation with an AsyncHandler. * * @see #discoverPollEndpointAsync(DiscoverPollEndpointRequest, com.amazonaws.handlers.AsyncHandler) */ @Override public java.util.concurrent.Future discoverPollEndpointAsync( com.amazonaws.handlers.AsyncHandler asyncHandler) { return discoverPollEndpointAsync(new DiscoverPollEndpointRequest(), asyncHandler); } @Override public java.util.concurrent.Future listAttributesAsync(ListAttributesRequest request) { return listAttributesAsync(request, null); } @Override public java.util.concurrent.Future listAttributesAsync(final ListAttributesRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final ListAttributesRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public ListAttributesResult call() throws Exception { ListAttributesResult result = null; try { result = executeListAttributes(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 listClustersAsync(ListClustersRequest request) { return listClustersAsync(request, null); } @Override public java.util.concurrent.Future listClustersAsync(final ListClustersRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final ListClustersRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public ListClustersResult call() throws Exception { ListClustersResult result = null; try { result = executeListClusters(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 ListClusters operation. * * @see #listClustersAsync(ListClustersRequest) */ @Override public java.util.concurrent.Future listClustersAsync() { return listClustersAsync(new ListClustersRequest()); } /** * Simplified method form for invoking the ListClusters operation with an AsyncHandler. * * @see #listClustersAsync(ListClustersRequest, com.amazonaws.handlers.AsyncHandler) */ @Override public java.util.concurrent.Future listClustersAsync( com.amazonaws.handlers.AsyncHandler asyncHandler) { return listClustersAsync(new ListClustersRequest(), asyncHandler); } @Override public java.util.concurrent.Future listContainerInstancesAsync(ListContainerInstancesRequest request) { return listContainerInstancesAsync(request, null); } @Override public java.util.concurrent.Future listContainerInstancesAsync(final ListContainerInstancesRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final ListContainerInstancesRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public ListContainerInstancesResult call() throws Exception { ListContainerInstancesResult result = null; try { result = executeListContainerInstances(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 ListContainerInstances operation. * * @see #listContainerInstancesAsync(ListContainerInstancesRequest) */ @Override public java.util.concurrent.Future listContainerInstancesAsync() { return listContainerInstancesAsync(new ListContainerInstancesRequest()); } /** * Simplified method form for invoking the ListContainerInstances operation with an AsyncHandler. * * @see #listContainerInstancesAsync(ListContainerInstancesRequest, com.amazonaws.handlers.AsyncHandler) */ @Override public java.util.concurrent.Future listContainerInstancesAsync( com.amazonaws.handlers.AsyncHandler asyncHandler) { return listContainerInstancesAsync(new ListContainerInstancesRequest(), asyncHandler); } @Override public java.util.concurrent.Future listServicesAsync(ListServicesRequest request) { return listServicesAsync(request, null); } @Override public java.util.concurrent.Future listServicesAsync(final ListServicesRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final ListServicesRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public ListServicesResult call() throws Exception { ListServicesResult result = null; try { result = executeListServices(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 ListServices operation. * * @see #listServicesAsync(ListServicesRequest) */ @Override public java.util.concurrent.Future listServicesAsync() { return listServicesAsync(new ListServicesRequest()); } /** * Simplified method form for invoking the ListServices operation with an AsyncHandler. * * @see #listServicesAsync(ListServicesRequest, com.amazonaws.handlers.AsyncHandler) */ @Override public java.util.concurrent.Future listServicesAsync( com.amazonaws.handlers.AsyncHandler asyncHandler) { return listServicesAsync(new ListServicesRequest(), asyncHandler); } @Override public java.util.concurrent.Future listTaskDefinitionFamiliesAsync(ListTaskDefinitionFamiliesRequest request) { return listTaskDefinitionFamiliesAsync(request, null); } @Override public java.util.concurrent.Future listTaskDefinitionFamiliesAsync(final ListTaskDefinitionFamiliesRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final ListTaskDefinitionFamiliesRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public ListTaskDefinitionFamiliesResult call() throws Exception { ListTaskDefinitionFamiliesResult result = null; try { result = executeListTaskDefinitionFamilies(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 ListTaskDefinitionFamilies operation. * * @see #listTaskDefinitionFamiliesAsync(ListTaskDefinitionFamiliesRequest) */ @Override public java.util.concurrent.Future listTaskDefinitionFamiliesAsync() { return listTaskDefinitionFamiliesAsync(new ListTaskDefinitionFamiliesRequest()); } /** * Simplified method form for invoking the ListTaskDefinitionFamilies operation with an AsyncHandler. * * @see #listTaskDefinitionFamiliesAsync(ListTaskDefinitionFamiliesRequest, com.amazonaws.handlers.AsyncHandler) */ @Override public java.util.concurrent.Future listTaskDefinitionFamiliesAsync( com.amazonaws.handlers.AsyncHandler asyncHandler) { return listTaskDefinitionFamiliesAsync(new ListTaskDefinitionFamiliesRequest(), asyncHandler); } @Override public java.util.concurrent.Future listTaskDefinitionsAsync(ListTaskDefinitionsRequest request) { return listTaskDefinitionsAsync(request, null); } @Override public java.util.concurrent.Future listTaskDefinitionsAsync(final ListTaskDefinitionsRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final ListTaskDefinitionsRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public ListTaskDefinitionsResult call() throws Exception { ListTaskDefinitionsResult result = null; try { result = executeListTaskDefinitions(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 ListTaskDefinitions operation. * * @see #listTaskDefinitionsAsync(ListTaskDefinitionsRequest) */ @Override public java.util.concurrent.Future listTaskDefinitionsAsync() { return listTaskDefinitionsAsync(new ListTaskDefinitionsRequest()); } /** * Simplified method form for invoking the ListTaskDefinitions operation with an AsyncHandler. * * @see #listTaskDefinitionsAsync(ListTaskDefinitionsRequest, com.amazonaws.handlers.AsyncHandler) */ @Override public java.util.concurrent.Future listTaskDefinitionsAsync( com.amazonaws.handlers.AsyncHandler asyncHandler) { return listTaskDefinitionsAsync(new ListTaskDefinitionsRequest(), asyncHandler); } @Override public java.util.concurrent.Future listTasksAsync(ListTasksRequest request) { return listTasksAsync(request, null); } @Override public java.util.concurrent.Future listTasksAsync(final ListTasksRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final ListTasksRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public ListTasksResult call() throws Exception { ListTasksResult result = null; try { result = executeListTasks(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 ListTasks operation. * * @see #listTasksAsync(ListTasksRequest) */ @Override public java.util.concurrent.Future listTasksAsync() { return listTasksAsync(new ListTasksRequest()); } /** * Simplified method form for invoking the ListTasks operation with an AsyncHandler. * * @see #listTasksAsync(ListTasksRequest, com.amazonaws.handlers.AsyncHandler) */ @Override public java.util.concurrent.Future listTasksAsync(com.amazonaws.handlers.AsyncHandler asyncHandler) { return listTasksAsync(new ListTasksRequest(), asyncHandler); } @Override public java.util.concurrent.Future putAttributesAsync(PutAttributesRequest request) { return putAttributesAsync(request, null); } @Override public java.util.concurrent.Future putAttributesAsync(final PutAttributesRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final PutAttributesRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public PutAttributesResult call() throws Exception { PutAttributesResult result = null; try { result = executePutAttributes(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 registerContainerInstanceAsync(RegisterContainerInstanceRequest request) { return registerContainerInstanceAsync(request, null); } @Override public java.util.concurrent.Future registerContainerInstanceAsync(final RegisterContainerInstanceRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final RegisterContainerInstanceRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public RegisterContainerInstanceResult call() throws Exception { RegisterContainerInstanceResult result = null; try { result = executeRegisterContainerInstance(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 registerTaskDefinitionAsync(RegisterTaskDefinitionRequest request) { return registerTaskDefinitionAsync(request, null); } @Override public java.util.concurrent.Future registerTaskDefinitionAsync(final RegisterTaskDefinitionRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final RegisterTaskDefinitionRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public RegisterTaskDefinitionResult call() throws Exception { RegisterTaskDefinitionResult result = null; try { result = executeRegisterTaskDefinition(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 runTaskAsync(RunTaskRequest request) { return runTaskAsync(request, null); } @Override public java.util.concurrent.Future runTaskAsync(final RunTaskRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final RunTaskRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public RunTaskResult call() throws Exception { RunTaskResult result = null; try { result = executeRunTask(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 startTaskAsync(StartTaskRequest request) { return startTaskAsync(request, null); } @Override public java.util.concurrent.Future startTaskAsync(final StartTaskRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final StartTaskRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public StartTaskResult call() throws Exception { StartTaskResult result = null; try { result = executeStartTask(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 stopTaskAsync(StopTaskRequest request) { return stopTaskAsync(request, null); } @Override public java.util.concurrent.Future stopTaskAsync(final StopTaskRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final StopTaskRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public StopTaskResult call() throws Exception { StopTaskResult result = null; try { result = executeStopTask(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 submitContainerStateChangeAsync(SubmitContainerStateChangeRequest request) { return submitContainerStateChangeAsync(request, null); } @Override public java.util.concurrent.Future submitContainerStateChangeAsync(final SubmitContainerStateChangeRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final SubmitContainerStateChangeRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public SubmitContainerStateChangeResult call() throws Exception { SubmitContainerStateChangeResult result = null; try { result = executeSubmitContainerStateChange(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 SubmitContainerStateChange operation. * * @see #submitContainerStateChangeAsync(SubmitContainerStateChangeRequest) */ @Override public java.util.concurrent.Future submitContainerStateChangeAsync() { return submitContainerStateChangeAsync(new SubmitContainerStateChangeRequest()); } /** * Simplified method form for invoking the SubmitContainerStateChange operation with an AsyncHandler. * * @see #submitContainerStateChangeAsync(SubmitContainerStateChangeRequest, com.amazonaws.handlers.AsyncHandler) */ @Override public java.util.concurrent.Future submitContainerStateChangeAsync( com.amazonaws.handlers.AsyncHandler asyncHandler) { return submitContainerStateChangeAsync(new SubmitContainerStateChangeRequest(), asyncHandler); } @Override public java.util.concurrent.Future submitTaskStateChangeAsync(SubmitTaskStateChangeRequest request) { return submitTaskStateChangeAsync(request, null); } @Override public java.util.concurrent.Future submitTaskStateChangeAsync(final SubmitTaskStateChangeRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final SubmitTaskStateChangeRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public SubmitTaskStateChangeResult call() throws Exception { SubmitTaskStateChangeResult result = null; try { result = executeSubmitTaskStateChange(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 updateContainerAgentAsync(UpdateContainerAgentRequest request) { return updateContainerAgentAsync(request, null); } @Override public java.util.concurrent.Future updateContainerAgentAsync(final UpdateContainerAgentRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final UpdateContainerAgentRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public UpdateContainerAgentResult call() throws Exception { UpdateContainerAgentResult result = null; try { result = executeUpdateContainerAgent(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 updateContainerInstancesStateAsync(UpdateContainerInstancesStateRequest request) { return updateContainerInstancesStateAsync(request, null); } @Override public java.util.concurrent.Future updateContainerInstancesStateAsync( final UpdateContainerInstancesStateRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final UpdateContainerInstancesStateRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public UpdateContainerInstancesStateResult call() throws Exception { UpdateContainerInstancesStateResult result = null; try { result = executeUpdateContainerInstancesState(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 updateServiceAsync(UpdateServiceRequest request) { return updateServiceAsync(request, null); } @Override public java.util.concurrent.Future updateServiceAsync(final UpdateServiceRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final UpdateServiceRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public UpdateServiceResult call() throws Exception { UpdateServiceResult result = null; try { result = executeUpdateService(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 - 2025 Weber Informatics LLC | Privacy Policy