/* * Copyright 2018-2023 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.entityresolution; import javax.annotation.Generated; import com.amazonaws.services.entityresolution.model.*; import com.amazonaws.client.AwsAsyncClientParams; import com.amazonaws.annotation.ThreadSafe; import java.util.concurrent.ExecutorService; /** * Client for accessing AWSEntityResolution 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. *

*

* Welcome to the AWS Entity Resolution API Reference. *

*

* AWS Entity Resolution is an AWS service that provides pre-configured entity resolution capabilities that enable * developers and analysts at advertising and marketing companies to build an accurate and complete view of their * consumers. *

*

* With AWS Entity Resolution, you have the ability to match source records containing consumer identifiers, such as * name, email address, and phone number. This holds true even when these records have incomplete or conflicting * identifiers. For example, AWS Entity Resolution can effectively match a source record from a customer relationship * management (CRM) system, which includes account information like first name, last name, postal address, phone number, * and email address, with a source record from a marketing system containing campaign information, such as username and * email address. *

*

* To learn more about AWS Entity Resolution concepts, procedures, and best practices, see the AWS Entity Resolution User * Guide. *

*/ @ThreadSafe @Generated("com.amazonaws:aws-java-sdk-code-generator") public class AWSEntityResolutionAsyncClient extends AWSEntityResolutionClient implements AWSEntityResolutionAsync { private static final int DEFAULT_THREAD_POOL_SIZE = 50; private final java.util.concurrent.ExecutorService executorService; public static AWSEntityResolutionAsyncClientBuilder asyncBuilder() { return AWSEntityResolutionAsyncClientBuilder.standard(); } /** * Constructs a new asynchronous client to invoke service methods on AWSEntityResolution using the specified * parameters. * * @param asyncClientParams * Object providing client parameters. */ AWSEntityResolutionAsyncClient(AwsAsyncClientParams asyncClientParams) { this(asyncClientParams, false); } /** * Constructs a new asynchronous client to invoke service methods on AWSEntityResolution using the specified * parameters. * * @param asyncClientParams * Object providing client parameters. * @param endpointDiscoveryEnabled * true will enable endpoint discovery if the service supports it. */ AWSEntityResolutionAsyncClient(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 createMatchingWorkflowAsync(CreateMatchingWorkflowRequest request) { return createMatchingWorkflowAsync(request, null); } @Override public java.util.concurrent.Future createMatchingWorkflowAsync(final CreateMatchingWorkflowRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final CreateMatchingWorkflowRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public CreateMatchingWorkflowResult call() throws Exception { CreateMatchingWorkflowResult result = null; try { result = executeCreateMatchingWorkflow(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 createSchemaMappingAsync(CreateSchemaMappingRequest request) { return createSchemaMappingAsync(request, null); } @Override public java.util.concurrent.Future createSchemaMappingAsync(final CreateSchemaMappingRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final CreateSchemaMappingRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public CreateSchemaMappingResult call() throws Exception { CreateSchemaMappingResult result = null; try { result = executeCreateSchemaMapping(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 deleteMatchingWorkflowAsync(DeleteMatchingWorkflowRequest request) { return deleteMatchingWorkflowAsync(request, null); } @Override public java.util.concurrent.Future deleteMatchingWorkflowAsync(final DeleteMatchingWorkflowRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final DeleteMatchingWorkflowRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public DeleteMatchingWorkflowResult call() throws Exception { DeleteMatchingWorkflowResult result = null; try { result = executeDeleteMatchingWorkflow(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 deleteSchemaMappingAsync(DeleteSchemaMappingRequest request) { return deleteSchemaMappingAsync(request, null); } @Override public java.util.concurrent.Future deleteSchemaMappingAsync(final DeleteSchemaMappingRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final DeleteSchemaMappingRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public DeleteSchemaMappingResult call() throws Exception { DeleteSchemaMappingResult result = null; try { result = executeDeleteSchemaMapping(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 getMatchIdAsync(GetMatchIdRequest request) { return getMatchIdAsync(request, null); } @Override public java.util.concurrent.Future getMatchIdAsync(final GetMatchIdRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final GetMatchIdRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public GetMatchIdResult call() throws Exception { GetMatchIdResult result = null; try { result = executeGetMatchId(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 getMatchingJobAsync(GetMatchingJobRequest request) { return getMatchingJobAsync(request, null); } @Override public java.util.concurrent.Future getMatchingJobAsync(final GetMatchingJobRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final GetMatchingJobRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public GetMatchingJobResult call() throws Exception { GetMatchingJobResult result = null; try { result = executeGetMatchingJob(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 getMatchingWorkflowAsync(GetMatchingWorkflowRequest request) { return getMatchingWorkflowAsync(request, null); } @Override public java.util.concurrent.Future getMatchingWorkflowAsync(final GetMatchingWorkflowRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final GetMatchingWorkflowRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public GetMatchingWorkflowResult call() throws Exception { GetMatchingWorkflowResult result = null; try { result = executeGetMatchingWorkflow(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 getSchemaMappingAsync(GetSchemaMappingRequest request) { return getSchemaMappingAsync(request, null); } @Override public java.util.concurrent.Future getSchemaMappingAsync(final GetSchemaMappingRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final GetSchemaMappingRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public GetSchemaMappingResult call() throws Exception { GetSchemaMappingResult result = null; try { result = executeGetSchemaMapping(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 listMatchingJobsAsync(ListMatchingJobsRequest request) { return listMatchingJobsAsync(request, null); } @Override public java.util.concurrent.Future listMatchingJobsAsync(final ListMatchingJobsRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final ListMatchingJobsRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public ListMatchingJobsResult call() throws Exception { ListMatchingJobsResult result = null; try { result = executeListMatchingJobs(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 listMatchingWorkflowsAsync(ListMatchingWorkflowsRequest request) { return listMatchingWorkflowsAsync(request, null); } @Override public java.util.concurrent.Future listMatchingWorkflowsAsync(final ListMatchingWorkflowsRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final ListMatchingWorkflowsRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public ListMatchingWorkflowsResult call() throws Exception { ListMatchingWorkflowsResult result = null; try { result = executeListMatchingWorkflows(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 listSchemaMappingsAsync(ListSchemaMappingsRequest request) { return listSchemaMappingsAsync(request, null); } @Override public java.util.concurrent.Future listSchemaMappingsAsync(final ListSchemaMappingsRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final ListSchemaMappingsRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public ListSchemaMappingsResult call() throws Exception { ListSchemaMappingsResult result = null; try { result = executeListSchemaMappings(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 startMatchingJobAsync(StartMatchingJobRequest request) { return startMatchingJobAsync(request, null); } @Override public java.util.concurrent.Future startMatchingJobAsync(final StartMatchingJobRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final StartMatchingJobRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public StartMatchingJobResult call() throws Exception { StartMatchingJobResult result = null; try { result = executeStartMatchingJob(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 updateMatchingWorkflowAsync(UpdateMatchingWorkflowRequest request) { return updateMatchingWorkflowAsync(request, null); } @Override public java.util.concurrent.Future updateMatchingWorkflowAsync(final UpdateMatchingWorkflowRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final UpdateMatchingWorkflowRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public UpdateMatchingWorkflowResult call() throws Exception { UpdateMatchingWorkflowResult result = null; try { result = executeUpdateMatchingWorkflow(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(); } }