com.amazonaws.services.bedrock.AmazonBedrockAsyncClient Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aws-java-sdk-bedrock Show documentation
Show all versions of aws-java-sdk-bedrock Show documentation
The AWS Java SDK for Amazon Bedrock module holds the client classes that are used for communicating with Amazon Bedrock Service
The newest version!
/*
* Copyright 2019-2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.bedrock;
import javax.annotation.Generated;
import com.amazonaws.services.bedrock.model.*;
import com.amazonaws.client.AwsAsyncClientParams;
import com.amazonaws.annotation.ThreadSafe;
import java.util.concurrent.ExecutorService;
/**
* Client for accessing Amazon Bedrock 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.
*
*
* Describes the API operations for creating, managing, fine-turning, and evaluating Amazon Bedrock models.
*
*/
@ThreadSafe
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class AmazonBedrockAsyncClient extends AmazonBedrockClient implements AmazonBedrockAsync {
private static final int DEFAULT_THREAD_POOL_SIZE = 50;
private final java.util.concurrent.ExecutorService executorService;
public static AmazonBedrockAsyncClientBuilder asyncBuilder() {
return AmazonBedrockAsyncClientBuilder.standard();
}
/**
* Constructs a new asynchronous client to invoke service methods on Amazon Bedrock using the specified parameters.
*
* @param asyncClientParams
* Object providing client parameters.
*/
AmazonBedrockAsyncClient(AwsAsyncClientParams asyncClientParams) {
this(asyncClientParams, false);
}
/**
* Constructs a new asynchronous client to invoke service methods on Amazon Bedrock using the specified parameters.
*
* @param asyncClientParams
* Object providing client parameters.
* @param endpointDiscoveryEnabled
* true will enable endpoint discovery if the service supports it.
*/
AmazonBedrockAsyncClient(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 createEvaluationJobAsync(CreateEvaluationJobRequest request) {
return createEvaluationJobAsync(request, null);
}
@Override
public java.util.concurrent.Future createEvaluationJobAsync(final CreateEvaluationJobRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final CreateEvaluationJobRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public CreateEvaluationJobResult call() throws Exception {
CreateEvaluationJobResult result = null;
try {
result = executeCreateEvaluationJob(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 createGuardrailAsync(CreateGuardrailRequest request) {
return createGuardrailAsync(request, null);
}
@Override
public java.util.concurrent.Future createGuardrailAsync(final CreateGuardrailRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final CreateGuardrailRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public CreateGuardrailResult call() throws Exception {
CreateGuardrailResult result = null;
try {
result = executeCreateGuardrail(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 createGuardrailVersionAsync(CreateGuardrailVersionRequest request) {
return createGuardrailVersionAsync(request, null);
}
@Override
public java.util.concurrent.Future createGuardrailVersionAsync(final CreateGuardrailVersionRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final CreateGuardrailVersionRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public CreateGuardrailVersionResult call() throws Exception {
CreateGuardrailVersionResult result = null;
try {
result = executeCreateGuardrailVersion(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 createModelCustomizationJobAsync(CreateModelCustomizationJobRequest request) {
return createModelCustomizationJobAsync(request, null);
}
@Override
public java.util.concurrent.Future createModelCustomizationJobAsync(final CreateModelCustomizationJobRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final CreateModelCustomizationJobRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public CreateModelCustomizationJobResult call() throws Exception {
CreateModelCustomizationJobResult result = null;
try {
result = executeCreateModelCustomizationJob(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 createProvisionedModelThroughputAsync(
CreateProvisionedModelThroughputRequest request) {
return createProvisionedModelThroughputAsync(request, null);
}
@Override
public java.util.concurrent.Future createProvisionedModelThroughputAsync(
final CreateProvisionedModelThroughputRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final CreateProvisionedModelThroughputRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public CreateProvisionedModelThroughputResult call() throws Exception {
CreateProvisionedModelThroughputResult result = null;
try {
result = executeCreateProvisionedModelThroughput(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 deleteCustomModelAsync(DeleteCustomModelRequest request) {
return deleteCustomModelAsync(request, null);
}
@Override
public java.util.concurrent.Future deleteCustomModelAsync(final DeleteCustomModelRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DeleteCustomModelRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DeleteCustomModelResult call() throws Exception {
DeleteCustomModelResult result = null;
try {
result = executeDeleteCustomModel(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 deleteGuardrailAsync(DeleteGuardrailRequest request) {
return deleteGuardrailAsync(request, null);
}
@Override
public java.util.concurrent.Future deleteGuardrailAsync(final DeleteGuardrailRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DeleteGuardrailRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DeleteGuardrailResult call() throws Exception {
DeleteGuardrailResult result = null;
try {
result = executeDeleteGuardrail(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 deleteModelInvocationLoggingConfigurationAsync(
DeleteModelInvocationLoggingConfigurationRequest request) {
return deleteModelInvocationLoggingConfigurationAsync(request, null);
}
@Override
public java.util.concurrent.Future deleteModelInvocationLoggingConfigurationAsync(
final DeleteModelInvocationLoggingConfigurationRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DeleteModelInvocationLoggingConfigurationRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DeleteModelInvocationLoggingConfigurationResult call() throws Exception {
DeleteModelInvocationLoggingConfigurationResult result = null;
try {
result = executeDeleteModelInvocationLoggingConfiguration(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 deleteProvisionedModelThroughputAsync(
DeleteProvisionedModelThroughputRequest request) {
return deleteProvisionedModelThroughputAsync(request, null);
}
@Override
public java.util.concurrent.Future deleteProvisionedModelThroughputAsync(
final DeleteProvisionedModelThroughputRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DeleteProvisionedModelThroughputRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DeleteProvisionedModelThroughputResult call() throws Exception {
DeleteProvisionedModelThroughputResult result = null;
try {
result = executeDeleteProvisionedModelThroughput(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 getCustomModelAsync(GetCustomModelRequest request) {
return getCustomModelAsync(request, null);
}
@Override
public java.util.concurrent.Future getCustomModelAsync(final GetCustomModelRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final GetCustomModelRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public GetCustomModelResult call() throws Exception {
GetCustomModelResult result = null;
try {
result = executeGetCustomModel(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 getEvaluationJobAsync(GetEvaluationJobRequest request) {
return getEvaluationJobAsync(request, null);
}
@Override
public java.util.concurrent.Future getEvaluationJobAsync(final GetEvaluationJobRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final GetEvaluationJobRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public GetEvaluationJobResult call() throws Exception {
GetEvaluationJobResult result = null;
try {
result = executeGetEvaluationJob(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 getFoundationModelAsync(GetFoundationModelRequest request) {
return getFoundationModelAsync(request, null);
}
@Override
public java.util.concurrent.Future getFoundationModelAsync(final GetFoundationModelRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final GetFoundationModelRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public GetFoundationModelResult call() throws Exception {
GetFoundationModelResult result = null;
try {
result = executeGetFoundationModel(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 getGuardrailAsync(GetGuardrailRequest request) {
return getGuardrailAsync(request, null);
}
@Override
public java.util.concurrent.Future getGuardrailAsync(final GetGuardrailRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final GetGuardrailRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public GetGuardrailResult call() throws Exception {
GetGuardrailResult result = null;
try {
result = executeGetGuardrail(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 getModelCustomizationJobAsync(GetModelCustomizationJobRequest request) {
return getModelCustomizationJobAsync(request, null);
}
@Override
public java.util.concurrent.Future getModelCustomizationJobAsync(final GetModelCustomizationJobRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final GetModelCustomizationJobRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public GetModelCustomizationJobResult call() throws Exception {
GetModelCustomizationJobResult result = null;
try {
result = executeGetModelCustomizationJob(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 getModelInvocationLoggingConfigurationAsync(
GetModelInvocationLoggingConfigurationRequest request) {
return getModelInvocationLoggingConfigurationAsync(request, null);
}
@Override
public java.util.concurrent.Future getModelInvocationLoggingConfigurationAsync(
final GetModelInvocationLoggingConfigurationRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final GetModelInvocationLoggingConfigurationRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public GetModelInvocationLoggingConfigurationResult call() throws Exception {
GetModelInvocationLoggingConfigurationResult result = null;
try {
result = executeGetModelInvocationLoggingConfiguration(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 getProvisionedModelThroughputAsync(GetProvisionedModelThroughputRequest request) {
return getProvisionedModelThroughputAsync(request, null);
}
@Override
public java.util.concurrent.Future getProvisionedModelThroughputAsync(
final GetProvisionedModelThroughputRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final GetProvisionedModelThroughputRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public GetProvisionedModelThroughputResult call() throws Exception {
GetProvisionedModelThroughputResult result = null;
try {
result = executeGetProvisionedModelThroughput(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 listCustomModelsAsync(ListCustomModelsRequest request) {
return listCustomModelsAsync(request, null);
}
@Override
public java.util.concurrent.Future listCustomModelsAsync(final ListCustomModelsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListCustomModelsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListCustomModelsResult call() throws Exception {
ListCustomModelsResult result = null;
try {
result = executeListCustomModels(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 listEvaluationJobsAsync(ListEvaluationJobsRequest request) {
return listEvaluationJobsAsync(request, null);
}
@Override
public java.util.concurrent.Future listEvaluationJobsAsync(final ListEvaluationJobsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListEvaluationJobsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListEvaluationJobsResult call() throws Exception {
ListEvaluationJobsResult result = null;
try {
result = executeListEvaluationJobs(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 listFoundationModelsAsync(ListFoundationModelsRequest request) {
return listFoundationModelsAsync(request, null);
}
@Override
public java.util.concurrent.Future listFoundationModelsAsync(final ListFoundationModelsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListFoundationModelsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListFoundationModelsResult call() throws Exception {
ListFoundationModelsResult result = null;
try {
result = executeListFoundationModels(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 listGuardrailsAsync(ListGuardrailsRequest request) {
return listGuardrailsAsync(request, null);
}
@Override
public java.util.concurrent.Future listGuardrailsAsync(final ListGuardrailsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListGuardrailsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListGuardrailsResult call() throws Exception {
ListGuardrailsResult result = null;
try {
result = executeListGuardrails(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 listModelCustomizationJobsAsync(ListModelCustomizationJobsRequest request) {
return listModelCustomizationJobsAsync(request, null);
}
@Override
public java.util.concurrent.Future listModelCustomizationJobsAsync(final ListModelCustomizationJobsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListModelCustomizationJobsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListModelCustomizationJobsResult call() throws Exception {
ListModelCustomizationJobsResult result = null;
try {
result = executeListModelCustomizationJobs(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 listProvisionedModelThroughputsAsync(
ListProvisionedModelThroughputsRequest request) {
return listProvisionedModelThroughputsAsync(request, null);
}
@Override
public java.util.concurrent.Future listProvisionedModelThroughputsAsync(
final ListProvisionedModelThroughputsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListProvisionedModelThroughputsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListProvisionedModelThroughputsResult call() throws Exception {
ListProvisionedModelThroughputsResult result = null;
try {
result = executeListProvisionedModelThroughputs(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 listTagsForResourceAsync(ListTagsForResourceRequest request) {
return listTagsForResourceAsync(request, null);
}
@Override
public java.util.concurrent.Future listTagsForResourceAsync(final ListTagsForResourceRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListTagsForResourceRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListTagsForResourceResult call() throws Exception {
ListTagsForResourceResult result = null;
try {
result = executeListTagsForResource(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future putModelInvocationLoggingConfigurationAsync(
PutModelInvocationLoggingConfigurationRequest request) {
return putModelInvocationLoggingConfigurationAsync(request, null);
}
@Override
public java.util.concurrent.Future putModelInvocationLoggingConfigurationAsync(
final PutModelInvocationLoggingConfigurationRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final PutModelInvocationLoggingConfigurationRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public PutModelInvocationLoggingConfigurationResult call() throws Exception {
PutModelInvocationLoggingConfigurationResult result = null;
try {
result = executePutModelInvocationLoggingConfiguration(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 stopEvaluationJobAsync(StopEvaluationJobRequest request) {
return stopEvaluationJobAsync(request, null);
}
@Override
public java.util.concurrent.Future stopEvaluationJobAsync(final StopEvaluationJobRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final StopEvaluationJobRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public StopEvaluationJobResult call() throws Exception {
StopEvaluationJobResult result = null;
try {
result = executeStopEvaluationJob(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 stopModelCustomizationJobAsync(StopModelCustomizationJobRequest request) {
return stopModelCustomizationJobAsync(request, null);
}
@Override
public java.util.concurrent.Future stopModelCustomizationJobAsync(final StopModelCustomizationJobRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final StopModelCustomizationJobRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public StopModelCustomizationJobResult call() throws Exception {
StopModelCustomizationJobResult result = null;
try {
result = executeStopModelCustomizationJob(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future tagResourceAsync(TagResourceRequest request) {
return tagResourceAsync(request, null);
}
@Override
public java.util.concurrent.Future tagResourceAsync(final TagResourceRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final TagResourceRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public TagResourceResult call() throws Exception {
TagResourceResult result = null;
try {
result = executeTagResource(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future untagResourceAsync(UntagResourceRequest request) {
return untagResourceAsync(request, null);
}
@Override
public java.util.concurrent.Future untagResourceAsync(final UntagResourceRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final UntagResourceRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public UntagResourceResult call() throws Exception {
UntagResourceResult result = null;
try {
result = executeUntagResource(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future updateGuardrailAsync(UpdateGuardrailRequest request) {
return updateGuardrailAsync(request, null);
}
@Override
public java.util.concurrent.Future updateGuardrailAsync(final UpdateGuardrailRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final UpdateGuardrailRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public UpdateGuardrailResult call() throws Exception {
UpdateGuardrailResult result = null;
try {
result = executeUpdateGuardrail(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 updateProvisionedModelThroughputAsync(
UpdateProvisionedModelThroughputRequest request) {
return updateProvisionedModelThroughputAsync(request, null);
}
@Override
public java.util.concurrent.Future updateProvisionedModelThroughputAsync(
final UpdateProvisionedModelThroughputRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final UpdateProvisionedModelThroughputRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public UpdateProvisionedModelThroughputResult call() throws Exception {
UpdateProvisionedModelThroughputResult result = null;
try {
result = executeUpdateProvisionedModelThroughput(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