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

com.amazonaws.services.athena.AmazonAthenaAsyncClient Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon Athena module holds the client classes that are used for communicating with Amazon Athena Service

There is a newer version: 1.12.780
Show newest version
/*
 * Copyright 2013-2018 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.athena;

import javax.annotation.Generated;

import com.amazonaws.services.athena.model.*;
import com.amazonaws.client.AwsAsyncClientParams;
import com.amazonaws.annotation.ThreadSafe;

import java.util.concurrent.ExecutorService;

/**
 * Client for accessing Amazon Athena 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 Athena is an interactive query service that lets you use standard SQL to analyze data directly in Amazon S3. * You can point Athena at your data in Amazon S3 and run ad-hoc queries and get results in seconds. Athena is * serverless, so there is no infrastructure to set up or manage. You pay only for the queries you run. Athena scales * automatically—executing queries in parallel—so results are fast, even with large datasets and complex queries. For * more information, see What is Amazon Athena in * the Amazon Athena User Guide. *

*

* For code samples using the AWS SDK for Java, see Examples and Code Samples in the Amazon * Athena User Guide. *

*/ @ThreadSafe @Generated("com.amazonaws:aws-java-sdk-code-generator") public class AmazonAthenaAsyncClient extends AmazonAthenaClient implements AmazonAthenaAsync { private static final int DEFAULT_THREAD_POOL_SIZE = 50; private final java.util.concurrent.ExecutorService executorService; public static AmazonAthenaAsyncClientBuilder asyncBuilder() { return AmazonAthenaAsyncClientBuilder.standard(); } /** * Constructs a new asynchronous client to invoke service methods on Amazon Athena using the specified parameters. * * @param asyncClientParams * Object providing client parameters. */ AmazonAthenaAsyncClient(AwsAsyncClientParams asyncClientParams) { super(asyncClientParams); this.executorService = asyncClientParams.getExecutor(); } /** * Returns the executor service used by this client to execute async requests. * * @return The executor service used by this client to execute async requests. */ public ExecutorService getExecutorService() { return executorService; } @Override public java.util.concurrent.Future batchGetNamedQueryAsync(BatchGetNamedQueryRequest request) { return batchGetNamedQueryAsync(request, null); } @Override public java.util.concurrent.Future batchGetNamedQueryAsync(final BatchGetNamedQueryRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final BatchGetNamedQueryRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public BatchGetNamedQueryResult call() throws Exception { BatchGetNamedQueryResult result = null; try { result = executeBatchGetNamedQuery(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 batchGetQueryExecutionAsync(BatchGetQueryExecutionRequest request) { return batchGetQueryExecutionAsync(request, null); } @Override public java.util.concurrent.Future batchGetQueryExecutionAsync(final BatchGetQueryExecutionRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final BatchGetQueryExecutionRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public BatchGetQueryExecutionResult call() throws Exception { BatchGetQueryExecutionResult result = null; try { result = executeBatchGetQueryExecution(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 createNamedQueryAsync(CreateNamedQueryRequest request) { return createNamedQueryAsync(request, null); } @Override public java.util.concurrent.Future createNamedQueryAsync(final CreateNamedQueryRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final CreateNamedQueryRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public CreateNamedQueryResult call() throws Exception { CreateNamedQueryResult result = null; try { result = executeCreateNamedQuery(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 deleteNamedQueryAsync(DeleteNamedQueryRequest request) { return deleteNamedQueryAsync(request, null); } @Override public java.util.concurrent.Future deleteNamedQueryAsync(final DeleteNamedQueryRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final DeleteNamedQueryRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public DeleteNamedQueryResult call() throws Exception { DeleteNamedQueryResult result = null; try { result = executeDeleteNamedQuery(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 getNamedQueryAsync(GetNamedQueryRequest request) { return getNamedQueryAsync(request, null); } @Override public java.util.concurrent.Future getNamedQueryAsync(final GetNamedQueryRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final GetNamedQueryRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public GetNamedQueryResult call() throws Exception { GetNamedQueryResult result = null; try { result = executeGetNamedQuery(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 getQueryExecutionAsync(GetQueryExecutionRequest request) { return getQueryExecutionAsync(request, null); } @Override public java.util.concurrent.Future getQueryExecutionAsync(final GetQueryExecutionRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final GetQueryExecutionRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public GetQueryExecutionResult call() throws Exception { GetQueryExecutionResult result = null; try { result = executeGetQueryExecution(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 getQueryResultsAsync(GetQueryResultsRequest request) { return getQueryResultsAsync(request, null); } @Override public java.util.concurrent.Future getQueryResultsAsync(final GetQueryResultsRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final GetQueryResultsRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public GetQueryResultsResult call() throws Exception { GetQueryResultsResult result = null; try { result = executeGetQueryResults(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 listNamedQueriesAsync(ListNamedQueriesRequest request) { return listNamedQueriesAsync(request, null); } @Override public java.util.concurrent.Future listNamedQueriesAsync(final ListNamedQueriesRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final ListNamedQueriesRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public ListNamedQueriesResult call() throws Exception { ListNamedQueriesResult result = null; try { result = executeListNamedQueries(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 listQueryExecutionsAsync(ListQueryExecutionsRequest request) { return listQueryExecutionsAsync(request, null); } @Override public java.util.concurrent.Future listQueryExecutionsAsync(final ListQueryExecutionsRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final ListQueryExecutionsRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public ListQueryExecutionsResult call() throws Exception { ListQueryExecutionsResult result = null; try { result = executeListQueryExecutions(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 startQueryExecutionAsync(StartQueryExecutionRequest request) { return startQueryExecutionAsync(request, null); } @Override public java.util.concurrent.Future startQueryExecutionAsync(final StartQueryExecutionRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final StartQueryExecutionRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public StartQueryExecutionResult call() throws Exception { StartQueryExecutionResult result = null; try { result = executeStartQueryExecution(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 stopQueryExecutionAsync(StopQueryExecutionRequest request) { return stopQueryExecutionAsync(request, null); } @Override public java.util.concurrent.Future stopQueryExecutionAsync(final StopQueryExecutionRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final StopQueryExecutionRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public StopQueryExecutionResult call() throws Exception { StopQueryExecutionResult result = null; try { result = executeStopQueryExecution(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