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

com.amazonaws.services.dynamodbv2.AmazonDynamoDBAsyncClient Maven / Gradle / Ivy

Go to download

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

There is a newer version: 1.12.765
Show newest version
/*
 * Copyright 2012-2017 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.dynamodbv2;

import static java.util.concurrent.Executors.newFixedThreadPool;

import javax.annotation.Generated;

import com.amazonaws.services.dynamodbv2.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 DynamoDB 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 DynamoDB *

* Amazon DynamoDB is a fully managed NoSQL database service that provides fast and predictable performance with * seamless scalability. DynamoDB lets you offload the administrative burdens of operating and scaling a distributed * database, so that you don't have to worry about hardware provisioning, setup and configuration, replication, software * patching, or cluster scaling. *

*

* With DynamoDB, you can create database tables that can store and retrieve any amount of data, and serve any level of * request traffic. You can scale up or scale down your tables' throughput capacity without downtime or performance * degradation, and use the AWS Management Console to monitor resource utilization and performance metrics. *

*

* DynamoDB automatically spreads the data and traffic for your tables over a sufficient number of servers to handle * your throughput and storage requirements, while maintaining consistent and fast performance. All of your data is * stored on solid state disks (SSDs) and automatically replicated across multiple Availability Zones in an AWS region, * providing built-in high availability and data durability. *

*/ @ThreadSafe @Generated("com.amazonaws:aws-java-sdk-code-generator") public class AmazonDynamoDBAsyncClient extends AmazonDynamoDBClient implements AmazonDynamoDBAsync { 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 DynamoDB. 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 AmazonDynamoDBAsyncClientBuilder#defaultClient()} */ @Deprecated public AmazonDynamoDBAsyncClient() { this(DefaultAWSCredentialsProviderChain.getInstance()); } /** * Constructs a new asynchronous client to invoke service methods on DynamoDB. 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 DynamoDB (ex: proxy settings, * retry counts, etc). * * @see com.amazonaws.auth.DefaultAWSCredentialsProviderChain * @see java.util.concurrent.Executors#newFixedThreadPool(int) * @deprecated use {@link AmazonDynamoDBAsyncClientBuilder#withClientConfiguration(ClientConfiguration)} */ @Deprecated public AmazonDynamoDBAsyncClient(ClientConfiguration clientConfiguration) { this(DefaultAWSCredentialsProviderChain.getInstance(), clientConfiguration, newFixedThreadPool(clientConfiguration.getMaxConnections())); } /** * Constructs a new asynchronous client to invoke service methods on DynamoDB 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 AmazonDynamoDBAsyncClientBuilder#withCredentials(AWSCredentialsProvider)} */ @Deprecated public AmazonDynamoDBAsyncClient(AWSCredentials awsCredentials) { this(awsCredentials, newFixedThreadPool(DEFAULT_THREAD_POOL_SIZE)); } /** * Constructs a new asynchronous client to invoke service methods on DynamoDB 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 AmazonDynamoDBAsyncClientBuilder#withCredentials(AWSCredentialsProvider)} and * {@link AmazonDynamoDBAsyncClientBuilder#withExecutorFactory(com.amazonaws.client.builder.ExecutorFactory)} */ @Deprecated public AmazonDynamoDBAsyncClient(AWSCredentials awsCredentials, ExecutorService executorService) { this(awsCredentials, configFactory.getConfig(), executorService); } /** * Constructs a new asynchronous client to invoke service methods on DynamoDB 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 AmazonDynamoDBAsyncClientBuilder#withCredentials(AWSCredentialsProvider)} and * {@link AmazonDynamoDBAsyncClientBuilder#withClientConfiguration(ClientConfiguration)} and * {@link AmazonDynamoDBAsyncClientBuilder#withExecutorFactory(com.amazonaws.client.builder.ExecutorFactory)} */ @Deprecated public AmazonDynamoDBAsyncClient(AWSCredentials awsCredentials, ClientConfiguration clientConfiguration, ExecutorService executorService) { super(awsCredentials, clientConfiguration); this.executorService = executorService; } /** * Constructs a new asynchronous client to invoke service methods on DynamoDB 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 AmazonDynamoDBAsyncClientBuilder#withCredentials(AWSCredentialsProvider)} */ @Deprecated public AmazonDynamoDBAsyncClient(AWSCredentialsProvider awsCredentialsProvider) { this(awsCredentialsProvider, newFixedThreadPool(DEFAULT_THREAD_POOL_SIZE)); } /** * Constructs a new asynchronous client to invoke service methods on DynamoDB 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 AmazonDynamoDBAsyncClientBuilder#withCredentials(AWSCredentialsProvider)} and * {@link AmazonDynamoDBAsyncClientBuilder#withClientConfiguration(ClientConfiguration)} */ @Deprecated public AmazonDynamoDBAsyncClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration) { this(awsCredentialsProvider, clientConfiguration, newFixedThreadPool(clientConfiguration.getMaxConnections())); } /** * Constructs a new asynchronous client to invoke service methods on DynamoDB 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 AmazonDynamoDBAsyncClientBuilder#withCredentials(AWSCredentialsProvider)} and * {@link AmazonDynamoDBAsyncClientBuilder#withExecutorFactory(com.amazonaws.client.builder.ExecutorFactory)} */ @Deprecated public AmazonDynamoDBAsyncClient(AWSCredentialsProvider awsCredentialsProvider, ExecutorService executorService) { this(awsCredentialsProvider, configFactory.getConfig(), executorService); } /** * Constructs a new asynchronous client to invoke service methods on DynamoDB 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 AmazonDynamoDBAsyncClientBuilder#withCredentials(AWSCredentialsProvider)} and * {@link AmazonDynamoDBAsyncClientBuilder#withClientConfiguration(ClientConfiguration)} and * {@link AmazonDynamoDBAsyncClientBuilder#withExecutorFactory(com.amazonaws.client.builder.ExecutorFactory)} */ @Deprecated public AmazonDynamoDBAsyncClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration, ExecutorService executorService) { super(awsCredentialsProvider, clientConfiguration); this.executorService = executorService; } public static AmazonDynamoDBAsyncClientBuilder asyncBuilder() { return AmazonDynamoDBAsyncClientBuilder.standard(); } /** * Constructs a new asynchronous client to invoke service methods on DynamoDB using the specified parameters. * * @param asyncClientParams * Object providing client parameters. */ AmazonDynamoDBAsyncClient(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 batchGetItemAsync(BatchGetItemRequest request) { return batchGetItemAsync(request, null); } @Override public java.util.concurrent.Future batchGetItemAsync(final BatchGetItemRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final BatchGetItemRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public BatchGetItemResult call() throws Exception { BatchGetItemResult result = null; try { result = executeBatchGetItem(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 BatchGetItem operation. * * @see #batchGetItemAsync(BatchGetItemRequest) */ @Override public java.util.concurrent.Future batchGetItemAsync(java.util.Map requestItems, String returnConsumedCapacity) { return batchGetItemAsync(new BatchGetItemRequest().withRequestItems(requestItems).withReturnConsumedCapacity(returnConsumedCapacity)); } /** * Simplified method form for invoking the BatchGetItem operation with an AsyncHandler. * * @see #batchGetItemAsync(BatchGetItemRequest, com.amazonaws.handlers.AsyncHandler) */ @Override public java.util.concurrent.Future batchGetItemAsync(java.util.Map requestItems, String returnConsumedCapacity, com.amazonaws.handlers.AsyncHandler asyncHandler) { return batchGetItemAsync(new BatchGetItemRequest().withRequestItems(requestItems).withReturnConsumedCapacity(returnConsumedCapacity), asyncHandler); } /** * Simplified method form for invoking the BatchGetItem operation. * * @see #batchGetItemAsync(BatchGetItemRequest) */ @Override public java.util.concurrent.Future batchGetItemAsync(java.util.Map requestItems) { return batchGetItemAsync(new BatchGetItemRequest().withRequestItems(requestItems)); } /** * Simplified method form for invoking the BatchGetItem operation with an AsyncHandler. * * @see #batchGetItemAsync(BatchGetItemRequest, com.amazonaws.handlers.AsyncHandler) */ @Override public java.util.concurrent.Future batchGetItemAsync(java.util.Map requestItems, com.amazonaws.handlers.AsyncHandler asyncHandler) { return batchGetItemAsync(new BatchGetItemRequest().withRequestItems(requestItems), asyncHandler); } @Override public java.util.concurrent.Future batchWriteItemAsync(BatchWriteItemRequest request) { return batchWriteItemAsync(request, null); } @Override public java.util.concurrent.Future batchWriteItemAsync(final BatchWriteItemRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final BatchWriteItemRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public BatchWriteItemResult call() throws Exception { BatchWriteItemResult result = null; try { result = executeBatchWriteItem(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 BatchWriteItem operation. * * @see #batchWriteItemAsync(BatchWriteItemRequest) */ @Override public java.util.concurrent.Future batchWriteItemAsync(java.util.Map> requestItems) { return batchWriteItemAsync(new BatchWriteItemRequest().withRequestItems(requestItems)); } /** * Simplified method form for invoking the BatchWriteItem operation with an AsyncHandler. * * @see #batchWriteItemAsync(BatchWriteItemRequest, com.amazonaws.handlers.AsyncHandler) */ @Override public java.util.concurrent.Future batchWriteItemAsync(java.util.Map> requestItems, com.amazonaws.handlers.AsyncHandler asyncHandler) { return batchWriteItemAsync(new BatchWriteItemRequest().withRequestItems(requestItems), asyncHandler); } @Override public java.util.concurrent.Future createTableAsync(CreateTableRequest request) { return createTableAsync(request, null); } @Override public java.util.concurrent.Future createTableAsync(final CreateTableRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final CreateTableRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public CreateTableResult call() throws Exception { CreateTableResult result = null; try { result = executeCreateTable(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 CreateTable operation. * * @see #createTableAsync(CreateTableRequest) */ @Override public java.util.concurrent.Future createTableAsync(java.util.List attributeDefinitions, String tableName, java.util.List keySchema, ProvisionedThroughput provisionedThroughput) { return createTableAsync(new CreateTableRequest().withAttributeDefinitions(attributeDefinitions).withTableName(tableName).withKeySchema(keySchema) .withProvisionedThroughput(provisionedThroughput)); } /** * Simplified method form for invoking the CreateTable operation with an AsyncHandler. * * @see #createTableAsync(CreateTableRequest, com.amazonaws.handlers.AsyncHandler) */ @Override public java.util.concurrent.Future createTableAsync(java.util.List attributeDefinitions, String tableName, java.util.List keySchema, ProvisionedThroughput provisionedThroughput, com.amazonaws.handlers.AsyncHandler asyncHandler) { return createTableAsync(new CreateTableRequest().withAttributeDefinitions(attributeDefinitions).withTableName(tableName).withKeySchema(keySchema) .withProvisionedThroughput(provisionedThroughput), asyncHandler); } @Override public java.util.concurrent.Future deleteItemAsync(DeleteItemRequest request) { return deleteItemAsync(request, null); } @Override public java.util.concurrent.Future deleteItemAsync(final DeleteItemRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final DeleteItemRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public DeleteItemResult call() throws Exception { DeleteItemResult result = null; try { result = executeDeleteItem(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 DeleteItem operation. * * @see #deleteItemAsync(DeleteItemRequest) */ @Override public java.util.concurrent.Future deleteItemAsync(String tableName, java.util.Map key) { return deleteItemAsync(new DeleteItemRequest().withTableName(tableName).withKey(key)); } /** * Simplified method form for invoking the DeleteItem operation with an AsyncHandler. * * @see #deleteItemAsync(DeleteItemRequest, com.amazonaws.handlers.AsyncHandler) */ @Override public java.util.concurrent.Future deleteItemAsync(String tableName, java.util.Map key, com.amazonaws.handlers.AsyncHandler asyncHandler) { return deleteItemAsync(new DeleteItemRequest().withTableName(tableName).withKey(key), asyncHandler); } /** * Simplified method form for invoking the DeleteItem operation. * * @see #deleteItemAsync(DeleteItemRequest) */ @Override public java.util.concurrent.Future deleteItemAsync(String tableName, java.util.Map key, String returnValues) { return deleteItemAsync(new DeleteItemRequest().withTableName(tableName).withKey(key).withReturnValues(returnValues)); } /** * Simplified method form for invoking the DeleteItem operation with an AsyncHandler. * * @see #deleteItemAsync(DeleteItemRequest, com.amazonaws.handlers.AsyncHandler) */ @Override public java.util.concurrent.Future deleteItemAsync(String tableName, java.util.Map key, String returnValues, com.amazonaws.handlers.AsyncHandler asyncHandler) { return deleteItemAsync(new DeleteItemRequest().withTableName(tableName).withKey(key).withReturnValues(returnValues), asyncHandler); } @Override public java.util.concurrent.Future deleteTableAsync(DeleteTableRequest request) { return deleteTableAsync(request, null); } @Override public java.util.concurrent.Future deleteTableAsync(final DeleteTableRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final DeleteTableRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public DeleteTableResult call() throws Exception { DeleteTableResult result = null; try { result = executeDeleteTable(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 DeleteTable operation. * * @see #deleteTableAsync(DeleteTableRequest) */ @Override public java.util.concurrent.Future deleteTableAsync(String tableName) { return deleteTableAsync(new DeleteTableRequest().withTableName(tableName)); } /** * Simplified method form for invoking the DeleteTable operation with an AsyncHandler. * * @see #deleteTableAsync(DeleteTableRequest, com.amazonaws.handlers.AsyncHandler) */ @Override public java.util.concurrent.Future deleteTableAsync(String tableName, com.amazonaws.handlers.AsyncHandler asyncHandler) { return deleteTableAsync(new DeleteTableRequest().withTableName(tableName), asyncHandler); } @Override public java.util.concurrent.Future describeLimitsAsync(DescribeLimitsRequest request) { return describeLimitsAsync(request, null); } @Override public java.util.concurrent.Future describeLimitsAsync(final DescribeLimitsRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final DescribeLimitsRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public DescribeLimitsResult call() throws Exception { DescribeLimitsResult result = null; try { result = executeDescribeLimits(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 describeTableAsync(DescribeTableRequest request) { return describeTableAsync(request, null); } @Override public java.util.concurrent.Future describeTableAsync(final DescribeTableRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final DescribeTableRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public DescribeTableResult call() throws Exception { DescribeTableResult result = null; try { result = executeDescribeTable(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 DescribeTable operation. * * @see #describeTableAsync(DescribeTableRequest) */ @Override public java.util.concurrent.Future describeTableAsync(String tableName) { return describeTableAsync(new DescribeTableRequest().withTableName(tableName)); } /** * Simplified method form for invoking the DescribeTable operation with an AsyncHandler. * * @see #describeTableAsync(DescribeTableRequest, com.amazonaws.handlers.AsyncHandler) */ @Override public java.util.concurrent.Future describeTableAsync(String tableName, com.amazonaws.handlers.AsyncHandler asyncHandler) { return describeTableAsync(new DescribeTableRequest().withTableName(tableName), asyncHandler); } @Override public java.util.concurrent.Future describeTimeToLiveAsync(DescribeTimeToLiveRequest request) { return describeTimeToLiveAsync(request, null); } @Override public java.util.concurrent.Future describeTimeToLiveAsync(final DescribeTimeToLiveRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final DescribeTimeToLiveRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public DescribeTimeToLiveResult call() throws Exception { DescribeTimeToLiveResult result = null; try { result = executeDescribeTimeToLive(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 getItemAsync(GetItemRequest request) { return getItemAsync(request, null); } @Override public java.util.concurrent.Future getItemAsync(final GetItemRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final GetItemRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public GetItemResult call() throws Exception { GetItemResult result = null; try { result = executeGetItem(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 GetItem operation. * * @see #getItemAsync(GetItemRequest) */ @Override public java.util.concurrent.Future getItemAsync(String tableName, java.util.Map key) { return getItemAsync(new GetItemRequest().withTableName(tableName).withKey(key)); } /** * Simplified method form for invoking the GetItem operation with an AsyncHandler. * * @see #getItemAsync(GetItemRequest, com.amazonaws.handlers.AsyncHandler) */ @Override public java.util.concurrent.Future getItemAsync(String tableName, java.util.Map key, com.amazonaws.handlers.AsyncHandler asyncHandler) { return getItemAsync(new GetItemRequest().withTableName(tableName).withKey(key), asyncHandler); } /** * Simplified method form for invoking the GetItem operation. * * @see #getItemAsync(GetItemRequest) */ @Override public java.util.concurrent.Future getItemAsync(String tableName, java.util.Map key, Boolean consistentRead) { return getItemAsync(new GetItemRequest().withTableName(tableName).withKey(key).withConsistentRead(consistentRead)); } /** * Simplified method form for invoking the GetItem operation with an AsyncHandler. * * @see #getItemAsync(GetItemRequest, com.amazonaws.handlers.AsyncHandler) */ @Override public java.util.concurrent.Future getItemAsync(String tableName, java.util.Map key, Boolean consistentRead, com.amazonaws.handlers.AsyncHandler asyncHandler) { return getItemAsync(new GetItemRequest().withTableName(tableName).withKey(key).withConsistentRead(consistentRead), asyncHandler); } @Override public java.util.concurrent.Future listTablesAsync(ListTablesRequest request) { return listTablesAsync(request, null); } @Override public java.util.concurrent.Future listTablesAsync(final ListTablesRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final ListTablesRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public ListTablesResult call() throws Exception { ListTablesResult result = null; try { result = executeListTables(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 ListTables operation. * * @see #listTablesAsync(ListTablesRequest) */ @Override public java.util.concurrent.Future listTablesAsync() { return listTablesAsync(new ListTablesRequest()); } /** * Simplified method form for invoking the ListTables operation with an AsyncHandler. * * @see #listTablesAsync(ListTablesRequest, com.amazonaws.handlers.AsyncHandler) */ @Override public java.util.concurrent.Future listTablesAsync(com.amazonaws.handlers.AsyncHandler asyncHandler) { return listTablesAsync(new ListTablesRequest(), asyncHandler); } /** * Simplified method form for invoking the ListTables operation. * * @see #listTablesAsync(ListTablesRequest) */ @Override public java.util.concurrent.Future listTablesAsync(String exclusiveStartTableName) { return listTablesAsync(new ListTablesRequest().withExclusiveStartTableName(exclusiveStartTableName)); } /** * Simplified method form for invoking the ListTables operation with an AsyncHandler. * * @see #listTablesAsync(ListTablesRequest, com.amazonaws.handlers.AsyncHandler) */ @Override public java.util.concurrent.Future listTablesAsync(String exclusiveStartTableName, com.amazonaws.handlers.AsyncHandler asyncHandler) { return listTablesAsync(new ListTablesRequest().withExclusiveStartTableName(exclusiveStartTableName), asyncHandler); } /** * Simplified method form for invoking the ListTables operation. * * @see #listTablesAsync(ListTablesRequest) */ @Override public java.util.concurrent.Future listTablesAsync(String exclusiveStartTableName, Integer limit) { return listTablesAsync(new ListTablesRequest().withExclusiveStartTableName(exclusiveStartTableName).withLimit(limit)); } /** * Simplified method form for invoking the ListTables operation with an AsyncHandler. * * @see #listTablesAsync(ListTablesRequest, com.amazonaws.handlers.AsyncHandler) */ @Override public java.util.concurrent.Future listTablesAsync(String exclusiveStartTableName, Integer limit, com.amazonaws.handlers.AsyncHandler asyncHandler) { return listTablesAsync(new ListTablesRequest().withExclusiveStartTableName(exclusiveStartTableName).withLimit(limit), asyncHandler); } /** * Simplified method form for invoking the ListTables operation. * * @see #listTablesAsync(ListTablesRequest) */ @Override public java.util.concurrent.Future listTablesAsync(Integer limit) { return listTablesAsync(new ListTablesRequest().withLimit(limit)); } /** * Simplified method form for invoking the ListTables operation with an AsyncHandler. * * @see #listTablesAsync(ListTablesRequest, com.amazonaws.handlers.AsyncHandler) */ @Override public java.util.concurrent.Future listTablesAsync(Integer limit, com.amazonaws.handlers.AsyncHandler asyncHandler) { return listTablesAsync(new ListTablesRequest().withLimit(limit), asyncHandler); } @Override public java.util.concurrent.Future listTagsOfResourceAsync(ListTagsOfResourceRequest request) { return listTagsOfResourceAsync(request, null); } @Override public java.util.concurrent.Future listTagsOfResourceAsync(final ListTagsOfResourceRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final ListTagsOfResourceRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public ListTagsOfResourceResult call() throws Exception { ListTagsOfResourceResult result = null; try { result = executeListTagsOfResource(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 putItemAsync(PutItemRequest request) { return putItemAsync(request, null); } @Override public java.util.concurrent.Future putItemAsync(final PutItemRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final PutItemRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public PutItemResult call() throws Exception { PutItemResult result = null; try { result = executePutItem(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 PutItem operation. * * @see #putItemAsync(PutItemRequest) */ @Override public java.util.concurrent.Future putItemAsync(String tableName, java.util.Map item) { return putItemAsync(new PutItemRequest().withTableName(tableName).withItem(item)); } /** * Simplified method form for invoking the PutItem operation with an AsyncHandler. * * @see #putItemAsync(PutItemRequest, com.amazonaws.handlers.AsyncHandler) */ @Override public java.util.concurrent.Future putItemAsync(String tableName, java.util.Map item, com.amazonaws.handlers.AsyncHandler asyncHandler) { return putItemAsync(new PutItemRequest().withTableName(tableName).withItem(item), asyncHandler); } /** * Simplified method form for invoking the PutItem operation. * * @see #putItemAsync(PutItemRequest) */ @Override public java.util.concurrent.Future putItemAsync(String tableName, java.util.Map item, String returnValues) { return putItemAsync(new PutItemRequest().withTableName(tableName).withItem(item).withReturnValues(returnValues)); } /** * Simplified method form for invoking the PutItem operation with an AsyncHandler. * * @see #putItemAsync(PutItemRequest, com.amazonaws.handlers.AsyncHandler) */ @Override public java.util.concurrent.Future putItemAsync(String tableName, java.util.Map item, String returnValues, com.amazonaws.handlers.AsyncHandler asyncHandler) { return putItemAsync(new PutItemRequest().withTableName(tableName).withItem(item).withReturnValues(returnValues), asyncHandler); } @Override public java.util.concurrent.Future queryAsync(QueryRequest request) { return queryAsync(request, null); } @Override public java.util.concurrent.Future queryAsync(final QueryRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final QueryRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public QueryResult call() throws Exception { QueryResult result = null; try { result = executeQuery(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 scanAsync(ScanRequest request) { return scanAsync(request, null); } @Override public java.util.concurrent.Future scanAsync(final ScanRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final ScanRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public ScanResult call() throws Exception { ScanResult result = null; try { result = executeScan(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 Scan operation. * * @see #scanAsync(ScanRequest) */ @Override public java.util.concurrent.Future scanAsync(String tableName, java.util.List attributesToGet) { return scanAsync(new ScanRequest().withTableName(tableName).withAttributesToGet(attributesToGet)); } /** * Simplified method form for invoking the Scan operation with an AsyncHandler. * * @see #scanAsync(ScanRequest, com.amazonaws.handlers.AsyncHandler) */ @Override public java.util.concurrent.Future scanAsync(String tableName, java.util.List attributesToGet, com.amazonaws.handlers.AsyncHandler asyncHandler) { return scanAsync(new ScanRequest().withTableName(tableName).withAttributesToGet(attributesToGet), asyncHandler); } /** * Simplified method form for invoking the Scan operation. * * @see #scanAsync(ScanRequest) */ @Override public java.util.concurrent.Future scanAsync(String tableName, java.util.Map scanFilter) { return scanAsync(new ScanRequest().withTableName(tableName).withScanFilter(scanFilter)); } /** * Simplified method form for invoking the Scan operation with an AsyncHandler. * * @see #scanAsync(ScanRequest, com.amazonaws.handlers.AsyncHandler) */ @Override public java.util.concurrent.Future scanAsync(String tableName, java.util.Map scanFilter, com.amazonaws.handlers.AsyncHandler asyncHandler) { return scanAsync(new ScanRequest().withTableName(tableName).withScanFilter(scanFilter), asyncHandler); } /** * Simplified method form for invoking the Scan operation. * * @see #scanAsync(ScanRequest) */ @Override public java.util.concurrent.Future scanAsync(String tableName, java.util.List attributesToGet, java.util.Map scanFilter) { return scanAsync(new ScanRequest().withTableName(tableName).withAttributesToGet(attributesToGet).withScanFilter(scanFilter)); } /** * Simplified method form for invoking the Scan operation with an AsyncHandler. * * @see #scanAsync(ScanRequest, com.amazonaws.handlers.AsyncHandler) */ @Override public java.util.concurrent.Future scanAsync(String tableName, java.util.List attributesToGet, java.util.Map scanFilter, com.amazonaws.handlers.AsyncHandler asyncHandler) { return scanAsync(new ScanRequest().withTableName(tableName).withAttributesToGet(attributesToGet).withScanFilter(scanFilter), asyncHandler); } @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 updateItemAsync(UpdateItemRequest request) { return updateItemAsync(request, null); } @Override public java.util.concurrent.Future updateItemAsync(final UpdateItemRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final UpdateItemRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public UpdateItemResult call() throws Exception { UpdateItemResult result = null; try { result = executeUpdateItem(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 UpdateItem operation. * * @see #updateItemAsync(UpdateItemRequest) */ @Override public java.util.concurrent.Future updateItemAsync(String tableName, java.util.Map key, java.util.Map attributeUpdates) { return updateItemAsync(new UpdateItemRequest().withTableName(tableName).withKey(key).withAttributeUpdates(attributeUpdates)); } /** * Simplified method form for invoking the UpdateItem operation with an AsyncHandler. * * @see #updateItemAsync(UpdateItemRequest, com.amazonaws.handlers.AsyncHandler) */ @Override public java.util.concurrent.Future updateItemAsync(String tableName, java.util.Map key, java.util.Map attributeUpdates, com.amazonaws.handlers.AsyncHandler asyncHandler) { return updateItemAsync(new UpdateItemRequest().withTableName(tableName).withKey(key).withAttributeUpdates(attributeUpdates), asyncHandler); } /** * Simplified method form for invoking the UpdateItem operation. * * @see #updateItemAsync(UpdateItemRequest) */ @Override public java.util.concurrent.Future updateItemAsync(String tableName, java.util.Map key, java.util.Map attributeUpdates, String returnValues) { return updateItemAsync(new UpdateItemRequest().withTableName(tableName).withKey(key).withAttributeUpdates(attributeUpdates) .withReturnValues(returnValues)); } /** * Simplified method form for invoking the UpdateItem operation with an AsyncHandler. * * @see #updateItemAsync(UpdateItemRequest, com.amazonaws.handlers.AsyncHandler) */ @Override public java.util.concurrent.Future updateItemAsync(String tableName, java.util.Map key, java.util.Map attributeUpdates, String returnValues, com.amazonaws.handlers.AsyncHandler asyncHandler) { return updateItemAsync( new UpdateItemRequest().withTableName(tableName).withKey(key).withAttributeUpdates(attributeUpdates).withReturnValues(returnValues), asyncHandler); } @Override public java.util.concurrent.Future updateTableAsync(UpdateTableRequest request) { return updateTableAsync(request, null); } @Override public java.util.concurrent.Future updateTableAsync(final UpdateTableRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final UpdateTableRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public UpdateTableResult call() throws Exception { UpdateTableResult result = null; try { result = executeUpdateTable(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 UpdateTable operation. * * @see #updateTableAsync(UpdateTableRequest) */ @Override public java.util.concurrent.Future updateTableAsync(String tableName, ProvisionedThroughput provisionedThroughput) { return updateTableAsync(new UpdateTableRequest().withTableName(tableName).withProvisionedThroughput(provisionedThroughput)); } /** * Simplified method form for invoking the UpdateTable operation with an AsyncHandler. * * @see #updateTableAsync(UpdateTableRequest, com.amazonaws.handlers.AsyncHandler) */ @Override public java.util.concurrent.Future updateTableAsync(String tableName, ProvisionedThroughput provisionedThroughput, com.amazonaws.handlers.AsyncHandler asyncHandler) { return updateTableAsync(new UpdateTableRequest().withTableName(tableName).withProvisionedThroughput(provisionedThroughput), asyncHandler); } @Override public java.util.concurrent.Future updateTimeToLiveAsync(UpdateTimeToLiveRequest request) { return updateTimeToLiveAsync(request, null); } @Override public java.util.concurrent.Future updateTimeToLiveAsync(final UpdateTimeToLiveRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final UpdateTimeToLiveRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public UpdateTimeToLiveResult call() throws Exception { UpdateTimeToLiveResult result = null; try { result = executeUpdateTimeToLive(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 - 2024 Weber Informatics LLC | Privacy Policy