com.amazonaws.services.machinelearning.AmazonMachineLearningAsyncClient Maven / Gradle / Ivy
Show all versions of aws-java-sdk-machinelearning Show documentation
/*
* 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.machinelearning;
import static java.util.concurrent.Executors.newFixedThreadPool;
import javax.annotation.Generated;
import com.amazonaws.services.machinelearning.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 Machine Learning 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.
*
* Definition of the public APIs exposed by Amazon Machine Learning
*/
@ThreadSafe
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class AmazonMachineLearningAsyncClient extends AmazonMachineLearningClient implements AmazonMachineLearningAsync {
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 Machine Learning. 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 AmazonMachineLearningAsyncClientBuilder#defaultClient()}
*/
@Deprecated
public AmazonMachineLearningAsyncClient() {
this(DefaultAWSCredentialsProviderChain.getInstance());
}
/**
* Constructs a new asynchronous client to invoke service methods on Amazon Machine Learning. 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 Machine Learning (ex:
* proxy settings, retry counts, etc).
*
* @see com.amazonaws.auth.DefaultAWSCredentialsProviderChain
* @see java.util.concurrent.Executors#newFixedThreadPool(int)
* @deprecated use {@link AmazonMachineLearningAsyncClientBuilder#withClientConfiguration(ClientConfiguration)}
*/
@Deprecated
public AmazonMachineLearningAsyncClient(ClientConfiguration clientConfiguration) {
this(DefaultAWSCredentialsProviderChain.getInstance(), clientConfiguration, newFixedThreadPool(clientConfiguration.getMaxConnections()));
}
/**
* Constructs a new asynchronous client to invoke service methods on Amazon Machine Learning 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 AmazonMachineLearningAsyncClientBuilder#withCredentials(AWSCredentialsProvider)}
*/
@Deprecated
public AmazonMachineLearningAsyncClient(AWSCredentials awsCredentials) {
this(awsCredentials, newFixedThreadPool(DEFAULT_THREAD_POOL_SIZE));
}
/**
* Constructs a new asynchronous client to invoke service methods on Amazon Machine Learning 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 AmazonMachineLearningAsyncClientBuilder#withCredentials(AWSCredentialsProvider)} and
* {@link AmazonMachineLearningAsyncClientBuilder#withExecutorFactory(com.amazonaws.client.builder.ExecutorFactory)}
*/
@Deprecated
public AmazonMachineLearningAsyncClient(AWSCredentials awsCredentials, ExecutorService executorService) {
this(awsCredentials, configFactory.getConfig(), executorService);
}
/**
* Constructs a new asynchronous client to invoke service methods on Amazon Machine Learning 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 AmazonMachineLearningAsyncClientBuilder#withCredentials(AWSCredentialsProvider)} and
* {@link AmazonMachineLearningAsyncClientBuilder#withClientConfiguration(ClientConfiguration)} and
* {@link AmazonMachineLearningAsyncClientBuilder#withExecutorFactory(com.amazonaws.client.builder.ExecutorFactory)}
*/
@Deprecated
public AmazonMachineLearningAsyncClient(AWSCredentials awsCredentials, ClientConfiguration clientConfiguration, ExecutorService executorService) {
super(awsCredentials, clientConfiguration);
this.executorService = executorService;
}
/**
* Constructs a new asynchronous client to invoke service methods on Amazon Machine Learning 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 AmazonMachineLearningAsyncClientBuilder#withCredentials(AWSCredentialsProvider)}
*/
@Deprecated
public AmazonMachineLearningAsyncClient(AWSCredentialsProvider awsCredentialsProvider) {
this(awsCredentialsProvider, newFixedThreadPool(DEFAULT_THREAD_POOL_SIZE));
}
/**
* Constructs a new asynchronous client to invoke service methods on Amazon Machine Learning 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 AmazonMachineLearningAsyncClientBuilder#withCredentials(AWSCredentialsProvider)} and
* {@link AmazonMachineLearningAsyncClientBuilder#withClientConfiguration(ClientConfiguration)}
*/
@Deprecated
public AmazonMachineLearningAsyncClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration) {
this(awsCredentialsProvider, clientConfiguration, newFixedThreadPool(clientConfiguration.getMaxConnections()));
}
/**
* Constructs a new asynchronous client to invoke service methods on Amazon Machine Learning 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 AmazonMachineLearningAsyncClientBuilder#withCredentials(AWSCredentialsProvider)} and
* {@link AmazonMachineLearningAsyncClientBuilder#withExecutorFactory(com.amazonaws.client.builder.ExecutorFactory)}
*/
@Deprecated
public AmazonMachineLearningAsyncClient(AWSCredentialsProvider awsCredentialsProvider, ExecutorService executorService) {
this(awsCredentialsProvider, configFactory.getConfig(), executorService);
}
/**
* Constructs a new asynchronous client to invoke service methods on Amazon Machine Learning 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 AmazonMachineLearningAsyncClientBuilder#withCredentials(AWSCredentialsProvider)} and
* {@link AmazonMachineLearningAsyncClientBuilder#withClientConfiguration(ClientConfiguration)} and
* {@link AmazonMachineLearningAsyncClientBuilder#withExecutorFactory(com.amazonaws.client.builder.ExecutorFactory)}
*/
@Deprecated
public AmazonMachineLearningAsyncClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration,
ExecutorService executorService) {
super(awsCredentialsProvider, clientConfiguration);
this.executorService = executorService;
}
public static AmazonMachineLearningAsyncClientBuilder asyncBuilder() {
return AmazonMachineLearningAsyncClientBuilder.standard();
}
/**
* Constructs a new asynchronous client to invoke service methods on Amazon Machine Learning using the specified
* parameters.
*
* @param asyncClientParams
* Object providing client parameters.
*/
AmazonMachineLearningAsyncClient(AwsAsyncClientParams asyncClientParams) {
this(asyncClientParams, false);
}
/**
* Constructs a new asynchronous client to invoke service methods on Amazon Machine Learning using the specified
* parameters.
*
* @param asyncClientParams
* Object providing client parameters.
* @param endpointDiscoveryEnabled
* true will enable endpoint discovery if the service supports it.
*/
AmazonMachineLearningAsyncClient(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 addTagsAsync(AddTagsRequest request) {
return addTagsAsync(request, null);
}
@Override
public java.util.concurrent.Future addTagsAsync(final AddTagsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final AddTagsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public AddTagsResult call() throws Exception {
AddTagsResult result = null;
try {
result = executeAddTags(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 createBatchPredictionAsync(CreateBatchPredictionRequest request) {
return createBatchPredictionAsync(request, null);
}
@Override
public java.util.concurrent.Future createBatchPredictionAsync(final CreateBatchPredictionRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final CreateBatchPredictionRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public CreateBatchPredictionResult call() throws Exception {
CreateBatchPredictionResult result = null;
try {
result = executeCreateBatchPrediction(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 createDataSourceFromRDSAsync(CreateDataSourceFromRDSRequest request) {
return createDataSourceFromRDSAsync(request, null);
}
@Override
public java.util.concurrent.Future createDataSourceFromRDSAsync(final CreateDataSourceFromRDSRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final CreateDataSourceFromRDSRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public CreateDataSourceFromRDSResult call() throws Exception {
CreateDataSourceFromRDSResult result = null;
try {
result = executeCreateDataSourceFromRDS(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 createDataSourceFromRedshiftAsync(CreateDataSourceFromRedshiftRequest request) {
return createDataSourceFromRedshiftAsync(request, null);
}
@Override
public java.util.concurrent.Future createDataSourceFromRedshiftAsync(final CreateDataSourceFromRedshiftRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final CreateDataSourceFromRedshiftRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public CreateDataSourceFromRedshiftResult call() throws Exception {
CreateDataSourceFromRedshiftResult result = null;
try {
result = executeCreateDataSourceFromRedshift(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 createDataSourceFromS3Async(CreateDataSourceFromS3Request request) {
return createDataSourceFromS3Async(request, null);
}
@Override
public java.util.concurrent.Future createDataSourceFromS3Async(final CreateDataSourceFromS3Request request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final CreateDataSourceFromS3Request finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public CreateDataSourceFromS3Result call() throws Exception {
CreateDataSourceFromS3Result result = null;
try {
result = executeCreateDataSourceFromS3(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 createEvaluationAsync(CreateEvaluationRequest request) {
return createEvaluationAsync(request, null);
}
@Override
public java.util.concurrent.Future createEvaluationAsync(final CreateEvaluationRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final CreateEvaluationRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public CreateEvaluationResult call() throws Exception {
CreateEvaluationResult result = null;
try {
result = executeCreateEvaluation(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 createMLModelAsync(CreateMLModelRequest request) {
return createMLModelAsync(request, null);
}
@Override
public java.util.concurrent.Future createMLModelAsync(final CreateMLModelRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final CreateMLModelRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public CreateMLModelResult call() throws Exception {
CreateMLModelResult result = null;
try {
result = executeCreateMLModel(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 createRealtimeEndpointAsync(CreateRealtimeEndpointRequest request) {
return createRealtimeEndpointAsync(request, null);
}
@Override
public java.util.concurrent.Future createRealtimeEndpointAsync(final CreateRealtimeEndpointRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final CreateRealtimeEndpointRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public CreateRealtimeEndpointResult call() throws Exception {
CreateRealtimeEndpointResult result = null;
try {
result = executeCreateRealtimeEndpoint(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 deleteBatchPredictionAsync(DeleteBatchPredictionRequest request) {
return deleteBatchPredictionAsync(request, null);
}
@Override
public java.util.concurrent.Future deleteBatchPredictionAsync(final DeleteBatchPredictionRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DeleteBatchPredictionRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DeleteBatchPredictionResult call() throws Exception {
DeleteBatchPredictionResult result = null;
try {
result = executeDeleteBatchPrediction(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 deleteDataSourceAsync(DeleteDataSourceRequest request) {
return deleteDataSourceAsync(request, null);
}
@Override
public java.util.concurrent.Future deleteDataSourceAsync(final DeleteDataSourceRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DeleteDataSourceRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DeleteDataSourceResult call() throws Exception {
DeleteDataSourceResult result = null;
try {
result = executeDeleteDataSource(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 deleteEvaluationAsync(DeleteEvaluationRequest request) {
return deleteEvaluationAsync(request, null);
}
@Override
public java.util.concurrent.Future deleteEvaluationAsync(final DeleteEvaluationRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DeleteEvaluationRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DeleteEvaluationResult call() throws Exception {
DeleteEvaluationResult result = null;
try {
result = executeDeleteEvaluation(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 deleteMLModelAsync(DeleteMLModelRequest request) {
return deleteMLModelAsync(request, null);
}
@Override
public java.util.concurrent.Future deleteMLModelAsync(final DeleteMLModelRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DeleteMLModelRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DeleteMLModelResult call() throws Exception {
DeleteMLModelResult result = null;
try {
result = executeDeleteMLModel(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 deleteRealtimeEndpointAsync(DeleteRealtimeEndpointRequest request) {
return deleteRealtimeEndpointAsync(request, null);
}
@Override
public java.util.concurrent.Future deleteRealtimeEndpointAsync(final DeleteRealtimeEndpointRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DeleteRealtimeEndpointRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DeleteRealtimeEndpointResult call() throws Exception {
DeleteRealtimeEndpointResult result = null;
try {
result = executeDeleteRealtimeEndpoint(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 deleteTagsAsync(DeleteTagsRequest request) {
return deleteTagsAsync(request, null);
}
@Override
public java.util.concurrent.Future deleteTagsAsync(final DeleteTagsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DeleteTagsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DeleteTagsResult call() throws Exception {
DeleteTagsResult result = null;
try {
result = executeDeleteTags(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 describeBatchPredictionsAsync(DescribeBatchPredictionsRequest request) {
return describeBatchPredictionsAsync(request, null);
}
@Override
public java.util.concurrent.Future describeBatchPredictionsAsync(final DescribeBatchPredictionsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DescribeBatchPredictionsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DescribeBatchPredictionsResult call() throws Exception {
DescribeBatchPredictionsResult result = null;
try {
result = executeDescribeBatchPredictions(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 DescribeBatchPredictions operation.
*
* @see #describeBatchPredictionsAsync(DescribeBatchPredictionsRequest)
*/
@Override
public java.util.concurrent.Future describeBatchPredictionsAsync() {
return describeBatchPredictionsAsync(new DescribeBatchPredictionsRequest());
}
/**
* Simplified method form for invoking the DescribeBatchPredictions operation with an AsyncHandler.
*
* @see #describeBatchPredictionsAsync(DescribeBatchPredictionsRequest, com.amazonaws.handlers.AsyncHandler)
*/
@Override
public java.util.concurrent.Future describeBatchPredictionsAsync(
com.amazonaws.handlers.AsyncHandler asyncHandler) {
return describeBatchPredictionsAsync(new DescribeBatchPredictionsRequest(), asyncHandler);
}
@Override
public java.util.concurrent.Future describeDataSourcesAsync(DescribeDataSourcesRequest request) {
return describeDataSourcesAsync(request, null);
}
@Override
public java.util.concurrent.Future describeDataSourcesAsync(final DescribeDataSourcesRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DescribeDataSourcesRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DescribeDataSourcesResult call() throws Exception {
DescribeDataSourcesResult result = null;
try {
result = executeDescribeDataSources(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 DescribeDataSources operation.
*
* @see #describeDataSourcesAsync(DescribeDataSourcesRequest)
*/
@Override
public java.util.concurrent.Future describeDataSourcesAsync() {
return describeDataSourcesAsync(new DescribeDataSourcesRequest());
}
/**
* Simplified method form for invoking the DescribeDataSources operation with an AsyncHandler.
*
* @see #describeDataSourcesAsync(DescribeDataSourcesRequest, com.amazonaws.handlers.AsyncHandler)
*/
@Override
public java.util.concurrent.Future describeDataSourcesAsync(
com.amazonaws.handlers.AsyncHandler asyncHandler) {
return describeDataSourcesAsync(new DescribeDataSourcesRequest(), asyncHandler);
}
@Override
public java.util.concurrent.Future describeEvaluationsAsync(DescribeEvaluationsRequest request) {
return describeEvaluationsAsync(request, null);
}
@Override
public java.util.concurrent.Future describeEvaluationsAsync(final DescribeEvaluationsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DescribeEvaluationsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DescribeEvaluationsResult call() throws Exception {
DescribeEvaluationsResult result = null;
try {
result = executeDescribeEvaluations(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 DescribeEvaluations operation.
*
* @see #describeEvaluationsAsync(DescribeEvaluationsRequest)
*/
@Override
public java.util.concurrent.Future describeEvaluationsAsync() {
return describeEvaluationsAsync(new DescribeEvaluationsRequest());
}
/**
* Simplified method form for invoking the DescribeEvaluations operation with an AsyncHandler.
*
* @see #describeEvaluationsAsync(DescribeEvaluationsRequest, com.amazonaws.handlers.AsyncHandler)
*/
@Override
public java.util.concurrent.Future describeEvaluationsAsync(
com.amazonaws.handlers.AsyncHandler asyncHandler) {
return describeEvaluationsAsync(new DescribeEvaluationsRequest(), asyncHandler);
}
@Override
public java.util.concurrent.Future describeMLModelsAsync(DescribeMLModelsRequest request) {
return describeMLModelsAsync(request, null);
}
@Override
public java.util.concurrent.Future describeMLModelsAsync(final DescribeMLModelsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DescribeMLModelsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DescribeMLModelsResult call() throws Exception {
DescribeMLModelsResult result = null;
try {
result = executeDescribeMLModels(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 DescribeMLModels operation.
*
* @see #describeMLModelsAsync(DescribeMLModelsRequest)
*/
@Override
public java.util.concurrent.Future describeMLModelsAsync() {
return describeMLModelsAsync(new DescribeMLModelsRequest());
}
/**
* Simplified method form for invoking the DescribeMLModels operation with an AsyncHandler.
*
* @see #describeMLModelsAsync(DescribeMLModelsRequest, com.amazonaws.handlers.AsyncHandler)
*/
@Override
public java.util.concurrent.Future describeMLModelsAsync(
com.amazonaws.handlers.AsyncHandler asyncHandler) {
return describeMLModelsAsync(new DescribeMLModelsRequest(), asyncHandler);
}
@Override
public java.util.concurrent.Future describeTagsAsync(DescribeTagsRequest request) {
return describeTagsAsync(request, null);
}
@Override
public java.util.concurrent.Future describeTagsAsync(final DescribeTagsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DescribeTagsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DescribeTagsResult call() throws Exception {
DescribeTagsResult result = null;
try {
result = executeDescribeTags(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 getBatchPredictionAsync(GetBatchPredictionRequest request) {
return getBatchPredictionAsync(request, null);
}
@Override
public java.util.concurrent.Future getBatchPredictionAsync(final GetBatchPredictionRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final GetBatchPredictionRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public GetBatchPredictionResult call() throws Exception {
GetBatchPredictionResult result = null;
try {
result = executeGetBatchPrediction(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 getDataSourceAsync(GetDataSourceRequest request) {
return getDataSourceAsync(request, null);
}
@Override
public java.util.concurrent.Future getDataSourceAsync(final GetDataSourceRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final GetDataSourceRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public GetDataSourceResult call() throws Exception {
GetDataSourceResult result = null;
try {
result = executeGetDataSource(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 getEvaluationAsync(GetEvaluationRequest request) {
return getEvaluationAsync(request, null);
}
@Override
public java.util.concurrent.Future getEvaluationAsync(final GetEvaluationRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final GetEvaluationRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public GetEvaluationResult call() throws Exception {
GetEvaluationResult result = null;
try {
result = executeGetEvaluation(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 getMLModelAsync(GetMLModelRequest request) {
return getMLModelAsync(request, null);
}
@Override
public java.util.concurrent.Future getMLModelAsync(final GetMLModelRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final GetMLModelRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public GetMLModelResult call() throws Exception {
GetMLModelResult result = null;
try {
result = executeGetMLModel(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 predictAsync(PredictRequest request) {
return predictAsync(request, null);
}
@Override
public java.util.concurrent.Future predictAsync(final PredictRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final PredictRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public PredictResult call() throws Exception {
PredictResult result = null;
try {
result = executePredict(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 updateBatchPredictionAsync(UpdateBatchPredictionRequest request) {
return updateBatchPredictionAsync(request, null);
}
@Override
public java.util.concurrent.Future updateBatchPredictionAsync(final UpdateBatchPredictionRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final UpdateBatchPredictionRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public UpdateBatchPredictionResult call() throws Exception {
UpdateBatchPredictionResult result = null;
try {
result = executeUpdateBatchPrediction(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 updateDataSourceAsync(UpdateDataSourceRequest request) {
return updateDataSourceAsync(request, null);
}
@Override
public java.util.concurrent.Future updateDataSourceAsync(final UpdateDataSourceRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final UpdateDataSourceRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public UpdateDataSourceResult call() throws Exception {
UpdateDataSourceResult result = null;
try {
result = executeUpdateDataSource(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 updateEvaluationAsync(UpdateEvaluationRequest request) {
return updateEvaluationAsync(request, null);
}
@Override
public java.util.concurrent.Future updateEvaluationAsync(final UpdateEvaluationRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final UpdateEvaluationRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public UpdateEvaluationResult call() throws Exception {
UpdateEvaluationResult result = null;
try {
result = executeUpdateEvaluation(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 updateMLModelAsync(UpdateMLModelRequest request) {
return updateMLModelAsync(request, null);
}
@Override
public java.util.concurrent.Future updateMLModelAsync(final UpdateMLModelRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final UpdateMLModelRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public UpdateMLModelResult call() throws Exception {
UpdateMLModelResult result = null;
try {
result = executeUpdateMLModel(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();
}
}