com.amazonaws.services.cloudsearchv2.AmazonCloudSearchAsyncClient Maven / Gradle / Ivy
/*
* Copyright 2011-2016 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.cloudsearchv2;
import com.amazonaws.services.cloudsearchv2.model.*;
import com.amazonaws.client.AwsAsyncClientParams;
import com.amazonaws.annotation.ThreadSafe;
/**
* Client for accessing Amazon CloudSearch 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 CloudSearch Configuration Service
*
* You use the Amazon CloudSearch configuration service to create, configure, and manage search domains. Configuration
* service requests are submitted using the AWS Query protocol. AWS Query requests are HTTP or HTTPS requests submitted
* via HTTP GET or POST with a query parameter named Action.
*
*
* The endpoint for configuration service requests is region-specific: cloudsearch.region.amazonaws.com. For
* example, cloudsearch.us-east-1.amazonaws.com. For a current list of supported regions and endpoints, see Regions and
* Endpoints.
*
*/
@ThreadSafe
public class AmazonCloudSearchAsyncClient extends AmazonCloudSearchClient implements AmazonCloudSearchAsync {
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 CloudSearch. 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)
*/
public AmazonCloudSearchAsyncClient() {
this(com.amazonaws.auth.DefaultAWSCredentialsProviderChain.getInstance());
}
/**
* Constructs a new asynchronous client to invoke service methods on Amazon CloudSearch. 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 CloudSearch (ex: proxy
* settings, retry counts, etc).
*
* @see com.amazonaws.auth.DefaultAWSCredentialsProviderChain
* @see java.util.concurrent.Executors#newFixedThreadPool(int)
*/
public AmazonCloudSearchAsyncClient(com.amazonaws.ClientConfiguration clientConfiguration) {
this(com.amazonaws.auth.DefaultAWSCredentialsProviderChain.getInstance(), clientConfiguration, java.util.concurrent.Executors
.newFixedThreadPool(clientConfiguration.getMaxConnections()));
}
/**
* Constructs a new asynchronous client to invoke service methods on Amazon CloudSearch 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)
*/
public AmazonCloudSearchAsyncClient(com.amazonaws.auth.AWSCredentials awsCredentials) {
this(awsCredentials, java.util.concurrent.Executors.newFixedThreadPool(DEFAULT_THREAD_POOL_SIZE));
}
/**
* Constructs a new asynchronous client to invoke service methods on Amazon CloudSearch 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.
*/
public AmazonCloudSearchAsyncClient(com.amazonaws.auth.AWSCredentials awsCredentials, java.util.concurrent.ExecutorService executorService) {
this(awsCredentials, configFactory.getConfig(), executorService);
}
/**
* Constructs a new asynchronous client to invoke service methods on Amazon CloudSearch 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.
*/
public AmazonCloudSearchAsyncClient(com.amazonaws.auth.AWSCredentials awsCredentials, com.amazonaws.ClientConfiguration clientConfiguration,
java.util.concurrent.ExecutorService executorService) {
super(awsCredentials, clientConfiguration);
this.executorService = executorService;
}
/**
* Constructs a new asynchronous client to invoke service methods on Amazon CloudSearch 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)
*/
public AmazonCloudSearchAsyncClient(com.amazonaws.auth.AWSCredentialsProvider awsCredentialsProvider) {
this(awsCredentialsProvider, java.util.concurrent.Executors.newFixedThreadPool(DEFAULT_THREAD_POOL_SIZE));
}
/**
* Constructs a new asynchronous client to invoke service methods on Amazon CloudSearch 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)
*/
public AmazonCloudSearchAsyncClient(com.amazonaws.auth.AWSCredentialsProvider awsCredentialsProvider, com.amazonaws.ClientConfiguration clientConfiguration) {
this(awsCredentialsProvider, clientConfiguration, java.util.concurrent.Executors.newFixedThreadPool(clientConfiguration.getMaxConnections()));
}
/**
* Constructs a new asynchronous client to invoke service methods on Amazon CloudSearch 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.
*/
public AmazonCloudSearchAsyncClient(com.amazonaws.auth.AWSCredentialsProvider awsCredentialsProvider, java.util.concurrent.ExecutorService executorService) {
this(awsCredentialsProvider, configFactory.getConfig(), executorService);
}
/**
* Constructs a new asynchronous client to invoke service methods on Amazon CloudSearch 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.
*/
public AmazonCloudSearchAsyncClient(com.amazonaws.auth.AWSCredentialsProvider awsCredentialsProvider,
com.amazonaws.ClientConfiguration clientConfiguration, java.util.concurrent.ExecutorService executorService) {
super(awsCredentialsProvider, clientConfiguration);
this.executorService = executorService;
}
/**
* Constructs a new asynchronous client to invoke service methods on Amazon CloudSearch using the specified
* parameters.
*
* @param asyncClientParams
* Object providing client parameters.
*/
AmazonCloudSearchAsyncClient(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 java.util.concurrent.ExecutorService getExecutorService() {
return executorService;
}
@Override
public java.util.concurrent.Future buildSuggestersAsync(BuildSuggestersRequest request) {
return buildSuggestersAsync(request, null);
}
@Override
public java.util.concurrent.Future buildSuggestersAsync(final BuildSuggestersRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public BuildSuggestersResult call() throws Exception {
BuildSuggestersResult result;
try {
result = buildSuggesters(request);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(request, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future createDomainAsync(CreateDomainRequest request) {
return createDomainAsync(request, null);
}
@Override
public java.util.concurrent.Future createDomainAsync(final CreateDomainRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public CreateDomainResult call() throws Exception {
CreateDomainResult result;
try {
result = createDomain(request);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(request, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future defineAnalysisSchemeAsync(DefineAnalysisSchemeRequest request) {
return defineAnalysisSchemeAsync(request, null);
}
@Override
public java.util.concurrent.Future defineAnalysisSchemeAsync(final DefineAnalysisSchemeRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DefineAnalysisSchemeResult call() throws Exception {
DefineAnalysisSchemeResult result;
try {
result = defineAnalysisScheme(request);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(request, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future defineExpressionAsync(DefineExpressionRequest request) {
return defineExpressionAsync(request, null);
}
@Override
public java.util.concurrent.Future defineExpressionAsync(final DefineExpressionRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DefineExpressionResult call() throws Exception {
DefineExpressionResult result;
try {
result = defineExpression(request);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(request, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future defineIndexFieldAsync(DefineIndexFieldRequest request) {
return defineIndexFieldAsync(request, null);
}
@Override
public java.util.concurrent.Future defineIndexFieldAsync(final DefineIndexFieldRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DefineIndexFieldResult call() throws Exception {
DefineIndexFieldResult result;
try {
result = defineIndexField(request);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(request, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future defineSuggesterAsync(DefineSuggesterRequest request) {
return defineSuggesterAsync(request, null);
}
@Override
public java.util.concurrent.Future defineSuggesterAsync(final DefineSuggesterRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DefineSuggesterResult call() throws Exception {
DefineSuggesterResult result;
try {
result = defineSuggester(request);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(request, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future deleteAnalysisSchemeAsync(DeleteAnalysisSchemeRequest request) {
return deleteAnalysisSchemeAsync(request, null);
}
@Override
public java.util.concurrent.Future deleteAnalysisSchemeAsync(final DeleteAnalysisSchemeRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DeleteAnalysisSchemeResult call() throws Exception {
DeleteAnalysisSchemeResult result;
try {
result = deleteAnalysisScheme(request);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(request, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future deleteDomainAsync(DeleteDomainRequest request) {
return deleteDomainAsync(request, null);
}
@Override
public java.util.concurrent.Future deleteDomainAsync(final DeleteDomainRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DeleteDomainResult call() throws Exception {
DeleteDomainResult result;
try {
result = deleteDomain(request);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(request, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future deleteExpressionAsync(DeleteExpressionRequest request) {
return deleteExpressionAsync(request, null);
}
@Override
public java.util.concurrent.Future deleteExpressionAsync(final DeleteExpressionRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DeleteExpressionResult call() throws Exception {
DeleteExpressionResult result;
try {
result = deleteExpression(request);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(request, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future deleteIndexFieldAsync(DeleteIndexFieldRequest request) {
return deleteIndexFieldAsync(request, null);
}
@Override
public java.util.concurrent.Future deleteIndexFieldAsync(final DeleteIndexFieldRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DeleteIndexFieldResult call() throws Exception {
DeleteIndexFieldResult result;
try {
result = deleteIndexField(request);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(request, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future deleteSuggesterAsync(DeleteSuggesterRequest request) {
return deleteSuggesterAsync(request, null);
}
@Override
public java.util.concurrent.Future deleteSuggesterAsync(final DeleteSuggesterRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DeleteSuggesterResult call() throws Exception {
DeleteSuggesterResult result;
try {
result = deleteSuggester(request);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(request, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future describeAnalysisSchemesAsync(DescribeAnalysisSchemesRequest request) {
return describeAnalysisSchemesAsync(request, null);
}
@Override
public java.util.concurrent.Future describeAnalysisSchemesAsync(final DescribeAnalysisSchemesRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DescribeAnalysisSchemesResult call() throws Exception {
DescribeAnalysisSchemesResult result;
try {
result = describeAnalysisSchemes(request);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(request, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future describeAvailabilityOptionsAsync(DescribeAvailabilityOptionsRequest request) {
return describeAvailabilityOptionsAsync(request, null);
}
@Override
public java.util.concurrent.Future describeAvailabilityOptionsAsync(final DescribeAvailabilityOptionsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DescribeAvailabilityOptionsResult call() throws Exception {
DescribeAvailabilityOptionsResult result;
try {
result = describeAvailabilityOptions(request);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(request, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future describeDomainsAsync(DescribeDomainsRequest request) {
return describeDomainsAsync(request, null);
}
@Override
public java.util.concurrent.Future describeDomainsAsync(final DescribeDomainsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DescribeDomainsResult call() throws Exception {
DescribeDomainsResult result;
try {
result = describeDomains(request);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(request, result);
}
return result;
}
});
}
/**
* Simplified method form for invoking the DescribeDomains operation.
*
* @see #describeDomainsAsync(DescribeDomainsRequest)
*/
@Override
public java.util.concurrent.Future describeDomainsAsync() {
return describeDomainsAsync(new DescribeDomainsRequest());
}
/**
* Simplified method form for invoking the DescribeDomains operation with an AsyncHandler.
*
* @see #describeDomainsAsync(DescribeDomainsRequest, com.amazonaws.handlers.AsyncHandler)
*/
public java.util.concurrent.Future describeDomainsAsync(
com.amazonaws.handlers.AsyncHandler asyncHandler) {
return describeDomainsAsync(new DescribeDomainsRequest(), asyncHandler);
}
@Override
public java.util.concurrent.Future describeExpressionsAsync(DescribeExpressionsRequest request) {
return describeExpressionsAsync(request, null);
}
@Override
public java.util.concurrent.Future describeExpressionsAsync(final DescribeExpressionsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DescribeExpressionsResult call() throws Exception {
DescribeExpressionsResult result;
try {
result = describeExpressions(request);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(request, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future describeIndexFieldsAsync(DescribeIndexFieldsRequest request) {
return describeIndexFieldsAsync(request, null);
}
@Override
public java.util.concurrent.Future describeIndexFieldsAsync(final DescribeIndexFieldsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DescribeIndexFieldsResult call() throws Exception {
DescribeIndexFieldsResult result;
try {
result = describeIndexFields(request);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(request, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future describeScalingParametersAsync(DescribeScalingParametersRequest request) {
return describeScalingParametersAsync(request, null);
}
@Override
public java.util.concurrent.Future describeScalingParametersAsync(final DescribeScalingParametersRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DescribeScalingParametersResult call() throws Exception {
DescribeScalingParametersResult result;
try {
result = describeScalingParameters(request);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(request, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future describeServiceAccessPoliciesAsync(DescribeServiceAccessPoliciesRequest request) {
return describeServiceAccessPoliciesAsync(request, null);
}
@Override
public java.util.concurrent.Future describeServiceAccessPoliciesAsync(
final DescribeServiceAccessPoliciesRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DescribeServiceAccessPoliciesResult call() throws Exception {
DescribeServiceAccessPoliciesResult result;
try {
result = describeServiceAccessPolicies(request);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(request, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future describeSuggestersAsync(DescribeSuggestersRequest request) {
return describeSuggestersAsync(request, null);
}
@Override
public java.util.concurrent.Future describeSuggestersAsync(final DescribeSuggestersRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DescribeSuggestersResult call() throws Exception {
DescribeSuggestersResult result;
try {
result = describeSuggesters(request);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(request, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future indexDocumentsAsync(IndexDocumentsRequest request) {
return indexDocumentsAsync(request, null);
}
@Override
public java.util.concurrent.Future indexDocumentsAsync(final IndexDocumentsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public IndexDocumentsResult call() throws Exception {
IndexDocumentsResult result;
try {
result = indexDocuments(request);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(request, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future listDomainNamesAsync(ListDomainNamesRequest request) {
return listDomainNamesAsync(request, null);
}
@Override
public java.util.concurrent.Future listDomainNamesAsync(final ListDomainNamesRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListDomainNamesResult call() throws Exception {
ListDomainNamesResult result;
try {
result = listDomainNames(request);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(request, result);
}
return result;
}
});
}
/**
* Simplified method form for invoking the ListDomainNames operation.
*
* @see #listDomainNamesAsync(ListDomainNamesRequest)
*/
@Override
public java.util.concurrent.Future listDomainNamesAsync() {
return listDomainNamesAsync(new ListDomainNamesRequest());
}
/**
* Simplified method form for invoking the ListDomainNames operation with an AsyncHandler.
*
* @see #listDomainNamesAsync(ListDomainNamesRequest, com.amazonaws.handlers.AsyncHandler)
*/
public java.util.concurrent.Future listDomainNamesAsync(
com.amazonaws.handlers.AsyncHandler asyncHandler) {
return listDomainNamesAsync(new ListDomainNamesRequest(), asyncHandler);
}
@Override
public java.util.concurrent.Future updateAvailabilityOptionsAsync(UpdateAvailabilityOptionsRequest request) {
return updateAvailabilityOptionsAsync(request, null);
}
@Override
public java.util.concurrent.Future updateAvailabilityOptionsAsync(final UpdateAvailabilityOptionsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public UpdateAvailabilityOptionsResult call() throws Exception {
UpdateAvailabilityOptionsResult result;
try {
result = updateAvailabilityOptions(request);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(request, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future updateScalingParametersAsync(UpdateScalingParametersRequest request) {
return updateScalingParametersAsync(request, null);
}
@Override
public java.util.concurrent.Future updateScalingParametersAsync(final UpdateScalingParametersRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public UpdateScalingParametersResult call() throws Exception {
UpdateScalingParametersResult result;
try {
result = updateScalingParameters(request);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(request, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future updateServiceAccessPoliciesAsync(UpdateServiceAccessPoliciesRequest request) {
return updateServiceAccessPoliciesAsync(request, null);
}
@Override
public java.util.concurrent.Future updateServiceAccessPoliciesAsync(final UpdateServiceAccessPoliciesRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public UpdateServiceAccessPoliciesResult call() throws Exception {
UpdateServiceAccessPoliciesResult result;
try {
result = updateServiceAccessPolicies(request);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(request, 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();
}
}