com.amazonaws.services.simpleworkflow.AmazonSimpleWorkflowAsyncClient Maven / Gradle / Ivy
Show all versions of aws-java-sdk-simpleworkflow Show documentation
/*
* 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.simpleworkflow;
import static java.util.concurrent.Executors.newFixedThreadPool;
import javax.annotation.Generated;
import com.amazonaws.services.simpleworkflow.model.*;
import com.amazonaws.client.AwsAsyncClientParams;
import com.amazonaws.annotation.ThreadSafe;
import com.amazonaws.ClientConfiguration;
import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.auth.AWSCredentialsProvider;
import java.util.concurrent.ExecutorService;
import com.amazonaws.auth.DefaultAWSCredentialsProviderChain;
/**
* Client for accessing Amazon SWF 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 Simple Workflow Service
*
* The Amazon Simple Workflow Service (Amazon SWF) makes it easy to build applications that use Amazon's cloud to
* coordinate work across distributed components. In Amazon SWF, a task represents a logical unit of work that is
* performed by a component of your workflow. Coordinating tasks in a workflow involves managing intertask dependencies,
* scheduling, and concurrency in accordance with the logical flow of the application.
*
*
* Amazon SWF gives you full control over implementing tasks and coordinating them without worrying about underlying
* complexities such as tracking their progress and maintaining their state.
*
*
* This documentation serves as reference only. For a broader overview of the Amazon SWF programming model, see the
* Amazon SWF Developer Guide .
*
*/
@ThreadSafe
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class AmazonSimpleWorkflowAsyncClient extends AmazonSimpleWorkflowClient implements AmazonSimpleWorkflowAsync {
private static final int DEFAULT_THREAD_POOL_SIZE = 50;
private final java.util.concurrent.ExecutorService executorService;
/**
* Constructs a new asynchronous client to invoke service methods on Amazon SWF. 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 AmazonSimpleWorkflowAsyncClientBuilder#defaultClient()}
*/
@Deprecated
public AmazonSimpleWorkflowAsyncClient() {
this(DefaultAWSCredentialsProviderChain.getInstance());
}
/**
* Constructs a new asynchronous client to invoke service methods on Amazon SWF. A credentials provider chain will
* be used that searches for credentials in this order:
*
* - Environment Variables - AWS_ACCESS_KEY_ID and AWS_SECRET_KEY
* - Java System Properties - aws.accessKeyId and aws.secretKey
* - Credential profiles file at the default location (~/.aws/credentials) shared by all AWS SDKs and the AWS CLI
* - Instance profile credentials delivered through the Amazon EC2 metadata service
*
*
* Asynchronous methods are delegated to a fixed-size thread pool containing a number of threads equal to the
* maximum number of concurrent connections configured via {@code ClientConfiguration.getMaxConnections()}.
*
* @param clientConfiguration
* The client configuration options controlling how this client connects to Amazon SWF (ex: proxy settings,
* retry counts, etc).
*
* @see com.amazonaws.auth.DefaultAWSCredentialsProviderChain
* @see java.util.concurrent.Executors#newFixedThreadPool(int)
* @deprecated use {@link AmazonSimpleWorkflowAsyncClientBuilder#withClientConfiguration(ClientConfiguration)}
*/
@Deprecated
public AmazonSimpleWorkflowAsyncClient(ClientConfiguration clientConfiguration) {
this(DefaultAWSCredentialsProviderChain.getInstance(), clientConfiguration, newFixedThreadPool(clientConfiguration.getMaxConnections()));
}
/**
* Constructs a new asynchronous client to invoke service methods on Amazon SWF 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 AmazonSimpleWorkflowAsyncClientBuilder#withCredentials(AWSCredentialsProvider)}
*/
@Deprecated
public AmazonSimpleWorkflowAsyncClient(AWSCredentials awsCredentials) {
this(awsCredentials, newFixedThreadPool(DEFAULT_THREAD_POOL_SIZE));
}
/**
* Constructs a new asynchronous client to invoke service methods on Amazon SWF 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 AmazonSimpleWorkflowAsyncClientBuilder#withCredentials(AWSCredentialsProvider)} and
* {@link AmazonSimpleWorkflowAsyncClientBuilder#withExecutorFactory(com.amazonaws.client.builder.ExecutorFactory)}
*/
@Deprecated
public AmazonSimpleWorkflowAsyncClient(AWSCredentials awsCredentials, ExecutorService executorService) {
this(awsCredentials, configFactory.getConfig(), executorService);
}
/**
* Constructs a new asynchronous client to invoke service methods on Amazon SWF 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 AmazonSimpleWorkflowAsyncClientBuilder#withCredentials(AWSCredentialsProvider)} and
* {@link AmazonSimpleWorkflowAsyncClientBuilder#withClientConfiguration(ClientConfiguration)} and
* {@link AmazonSimpleWorkflowAsyncClientBuilder#withExecutorFactory(com.amazonaws.client.builder.ExecutorFactory)}
*/
@Deprecated
public AmazonSimpleWorkflowAsyncClient(AWSCredentials awsCredentials, ClientConfiguration clientConfiguration, ExecutorService executorService) {
super(awsCredentials, clientConfiguration);
this.executorService = executorService;
}
/**
* Constructs a new asynchronous client to invoke service methods on Amazon SWF 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 AmazonSimpleWorkflowAsyncClientBuilder#withCredentials(AWSCredentialsProvider)}
*/
@Deprecated
public AmazonSimpleWorkflowAsyncClient(AWSCredentialsProvider awsCredentialsProvider) {
this(awsCredentialsProvider, newFixedThreadPool(DEFAULT_THREAD_POOL_SIZE));
}
/**
* Constructs a new asynchronous client to invoke service methods on Amazon SWF 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 AmazonSimpleWorkflowAsyncClientBuilder#withCredentials(AWSCredentialsProvider)} and
* {@link AmazonSimpleWorkflowAsyncClientBuilder#withClientConfiguration(ClientConfiguration)}
*/
@Deprecated
public AmazonSimpleWorkflowAsyncClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration) {
this(awsCredentialsProvider, clientConfiguration, newFixedThreadPool(clientConfiguration.getMaxConnections()));
}
/**
* Constructs a new asynchronous client to invoke service methods on Amazon SWF 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 AmazonSimpleWorkflowAsyncClientBuilder#withCredentials(AWSCredentialsProvider)} and
* {@link AmazonSimpleWorkflowAsyncClientBuilder#withExecutorFactory(com.amazonaws.client.builder.ExecutorFactory)}
*/
@Deprecated
public AmazonSimpleWorkflowAsyncClient(AWSCredentialsProvider awsCredentialsProvider, ExecutorService executorService) {
this(awsCredentialsProvider, configFactory.getConfig(), executorService);
}
/**
* Constructs a new asynchronous client to invoke service methods on Amazon SWF 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 AmazonSimpleWorkflowAsyncClientBuilder#withCredentials(AWSCredentialsProvider)} and
* {@link AmazonSimpleWorkflowAsyncClientBuilder#withClientConfiguration(ClientConfiguration)} and
* {@link AmazonSimpleWorkflowAsyncClientBuilder#withExecutorFactory(com.amazonaws.client.builder.ExecutorFactory)}
*/
@Deprecated
public AmazonSimpleWorkflowAsyncClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration,
ExecutorService executorService) {
super(awsCredentialsProvider, clientConfiguration);
this.executorService = executorService;
}
public static AmazonSimpleWorkflowAsyncClientBuilder asyncBuilder() {
return AmazonSimpleWorkflowAsyncClientBuilder.standard();
}
/**
* Constructs a new asynchronous client to invoke service methods on Amazon SWF using the specified parameters.
*
* @param asyncClientParams
* Object providing client parameters.
*/
AmazonSimpleWorkflowAsyncClient(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 countClosedWorkflowExecutionsAsync(CountClosedWorkflowExecutionsRequest request) {
return countClosedWorkflowExecutionsAsync(request, null);
}
@Override
public java.util.concurrent.Future countClosedWorkflowExecutionsAsync(final CountClosedWorkflowExecutionsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final CountClosedWorkflowExecutionsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public WorkflowExecutionCount call() throws Exception {
WorkflowExecutionCount result = null;
try {
result = executeCountClosedWorkflowExecutions(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 countOpenWorkflowExecutionsAsync(CountOpenWorkflowExecutionsRequest request) {
return countOpenWorkflowExecutionsAsync(request, null);
}
@Override
public java.util.concurrent.Future countOpenWorkflowExecutionsAsync(final CountOpenWorkflowExecutionsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final CountOpenWorkflowExecutionsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public WorkflowExecutionCount call() throws Exception {
WorkflowExecutionCount result = null;
try {
result = executeCountOpenWorkflowExecutions(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 countPendingActivityTasksAsync(CountPendingActivityTasksRequest request) {
return countPendingActivityTasksAsync(request, null);
}
@Override
public java.util.concurrent.Future countPendingActivityTasksAsync(final CountPendingActivityTasksRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final CountPendingActivityTasksRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public PendingTaskCount call() throws Exception {
PendingTaskCount result = null;
try {
result = executeCountPendingActivityTasks(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 countPendingDecisionTasksAsync(CountPendingDecisionTasksRequest request) {
return countPendingDecisionTasksAsync(request, null);
}
@Override
public java.util.concurrent.Future countPendingDecisionTasksAsync(final CountPendingDecisionTasksRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final CountPendingDecisionTasksRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public PendingTaskCount call() throws Exception {
PendingTaskCount result = null;
try {
result = executeCountPendingDecisionTasks(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 deprecateActivityTypeAsync(DeprecateActivityTypeRequest request) {
return deprecateActivityTypeAsync(request, null);
}
@Override
public java.util.concurrent.Future deprecateActivityTypeAsync(final DeprecateActivityTypeRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DeprecateActivityTypeRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public Void call() throws Exception {
Void result = null;
try {
executeDeprecateActivityType(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 deprecateDomainAsync(DeprecateDomainRequest request) {
return deprecateDomainAsync(request, null);
}
@Override
public java.util.concurrent.Future deprecateDomainAsync(final DeprecateDomainRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DeprecateDomainRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public Void call() throws Exception {
Void result = null;
try {
executeDeprecateDomain(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 deprecateWorkflowTypeAsync(DeprecateWorkflowTypeRequest request) {
return deprecateWorkflowTypeAsync(request, null);
}
@Override
public java.util.concurrent.Future deprecateWorkflowTypeAsync(final DeprecateWorkflowTypeRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DeprecateWorkflowTypeRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public Void call() throws Exception {
Void result = null;
try {
executeDeprecateWorkflowType(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 describeActivityTypeAsync(DescribeActivityTypeRequest request) {
return describeActivityTypeAsync(request, null);
}
@Override
public java.util.concurrent.Future describeActivityTypeAsync(final DescribeActivityTypeRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DescribeActivityTypeRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ActivityTypeDetail call() throws Exception {
ActivityTypeDetail result = null;
try {
result = executeDescribeActivityType(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 describeDomainAsync(DescribeDomainRequest request) {
return describeDomainAsync(request, null);
}
@Override
public java.util.concurrent.Future describeDomainAsync(final DescribeDomainRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DescribeDomainRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DomainDetail call() throws Exception {
DomainDetail result = null;
try {
result = executeDescribeDomain(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 describeWorkflowExecutionAsync(DescribeWorkflowExecutionRequest request) {
return describeWorkflowExecutionAsync(request, null);
}
@Override
public java.util.concurrent.Future describeWorkflowExecutionAsync(final DescribeWorkflowExecutionRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DescribeWorkflowExecutionRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public WorkflowExecutionDetail call() throws Exception {
WorkflowExecutionDetail result = null;
try {
result = executeDescribeWorkflowExecution(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 describeWorkflowTypeAsync(DescribeWorkflowTypeRequest request) {
return describeWorkflowTypeAsync(request, null);
}
@Override
public java.util.concurrent.Future describeWorkflowTypeAsync(final DescribeWorkflowTypeRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DescribeWorkflowTypeRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public WorkflowTypeDetail call() throws Exception {
WorkflowTypeDetail result = null;
try {
result = executeDescribeWorkflowType(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 getWorkflowExecutionHistoryAsync(GetWorkflowExecutionHistoryRequest request) {
return getWorkflowExecutionHistoryAsync(request, null);
}
@Override
public java.util.concurrent.Future getWorkflowExecutionHistoryAsync(final GetWorkflowExecutionHistoryRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final GetWorkflowExecutionHistoryRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public History call() throws Exception {
History result = null;
try {
result = executeGetWorkflowExecutionHistory(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 listActivityTypesAsync(ListActivityTypesRequest request) {
return listActivityTypesAsync(request, null);
}
@Override
public java.util.concurrent.Future listActivityTypesAsync(final ListActivityTypesRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListActivityTypesRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ActivityTypeInfos call() throws Exception {
ActivityTypeInfos result = null;
try {
result = executeListActivityTypes(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 listClosedWorkflowExecutionsAsync(ListClosedWorkflowExecutionsRequest request) {
return listClosedWorkflowExecutionsAsync(request, null);
}
@Override
public java.util.concurrent.Future listClosedWorkflowExecutionsAsync(final ListClosedWorkflowExecutionsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListClosedWorkflowExecutionsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public WorkflowExecutionInfos call() throws Exception {
WorkflowExecutionInfos result = null;
try {
result = executeListClosedWorkflowExecutions(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 listDomainsAsync(ListDomainsRequest request) {
return listDomainsAsync(request, null);
}
@Override
public java.util.concurrent.Future listDomainsAsync(final ListDomainsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListDomainsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DomainInfos call() throws Exception {
DomainInfos result = null;
try {
result = executeListDomains(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 listOpenWorkflowExecutionsAsync(ListOpenWorkflowExecutionsRequest request) {
return listOpenWorkflowExecutionsAsync(request, null);
}
@Override
public java.util.concurrent.Future listOpenWorkflowExecutionsAsync(final ListOpenWorkflowExecutionsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListOpenWorkflowExecutionsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public WorkflowExecutionInfos call() throws Exception {
WorkflowExecutionInfos result = null;
try {
result = executeListOpenWorkflowExecutions(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 listWorkflowTypesAsync(ListWorkflowTypesRequest request) {
return listWorkflowTypesAsync(request, null);
}
@Override
public java.util.concurrent.Future listWorkflowTypesAsync(final ListWorkflowTypesRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListWorkflowTypesRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public WorkflowTypeInfos call() throws Exception {
WorkflowTypeInfos result = null;
try {
result = executeListWorkflowTypes(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 pollForActivityTaskAsync(PollForActivityTaskRequest request) {
return pollForActivityTaskAsync(request, null);
}
@Override
public java.util.concurrent.Future pollForActivityTaskAsync(final PollForActivityTaskRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final PollForActivityTaskRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ActivityTask call() throws Exception {
ActivityTask result = null;
try {
result = executePollForActivityTask(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 pollForDecisionTaskAsync(PollForDecisionTaskRequest request) {
return pollForDecisionTaskAsync(request, null);
}
@Override
public java.util.concurrent.Future pollForDecisionTaskAsync(final PollForDecisionTaskRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final PollForDecisionTaskRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DecisionTask call() throws Exception {
DecisionTask result = null;
try {
result = executePollForDecisionTask(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 recordActivityTaskHeartbeatAsync(RecordActivityTaskHeartbeatRequest request) {
return recordActivityTaskHeartbeatAsync(request, null);
}
@Override
public java.util.concurrent.Future recordActivityTaskHeartbeatAsync(final RecordActivityTaskHeartbeatRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final RecordActivityTaskHeartbeatRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ActivityTaskStatus call() throws Exception {
ActivityTaskStatus result = null;
try {
result = executeRecordActivityTaskHeartbeat(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 registerActivityTypeAsync(RegisterActivityTypeRequest request) {
return registerActivityTypeAsync(request, null);
}
@Override
public java.util.concurrent.Future registerActivityTypeAsync(final RegisterActivityTypeRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final RegisterActivityTypeRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public Void call() throws Exception {
Void result = null;
try {
executeRegisterActivityType(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 registerDomainAsync(RegisterDomainRequest request) {
return registerDomainAsync(request, null);
}
@Override
public java.util.concurrent.Future registerDomainAsync(final RegisterDomainRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final RegisterDomainRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public Void call() throws Exception {
Void result = null;
try {
executeRegisterDomain(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 registerWorkflowTypeAsync(RegisterWorkflowTypeRequest request) {
return registerWorkflowTypeAsync(request, null);
}
@Override
public java.util.concurrent.Future registerWorkflowTypeAsync(final RegisterWorkflowTypeRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final RegisterWorkflowTypeRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public Void call() throws Exception {
Void result = null;
try {
executeRegisterWorkflowType(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 requestCancelWorkflowExecutionAsync(RequestCancelWorkflowExecutionRequest request) {
return requestCancelWorkflowExecutionAsync(request, null);
}
@Override
public java.util.concurrent.Future requestCancelWorkflowExecutionAsync(final RequestCancelWorkflowExecutionRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final RequestCancelWorkflowExecutionRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public Void call() throws Exception {
Void result = null;
try {
executeRequestCancelWorkflowExecution(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 respondActivityTaskCanceledAsync(RespondActivityTaskCanceledRequest request) {
return respondActivityTaskCanceledAsync(request, null);
}
@Override
public java.util.concurrent.Future respondActivityTaskCanceledAsync(final RespondActivityTaskCanceledRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final RespondActivityTaskCanceledRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public Void call() throws Exception {
Void result = null;
try {
executeRespondActivityTaskCanceled(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 respondActivityTaskCompletedAsync(RespondActivityTaskCompletedRequest request) {
return respondActivityTaskCompletedAsync(request, null);
}
@Override
public java.util.concurrent.Future respondActivityTaskCompletedAsync(final RespondActivityTaskCompletedRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final RespondActivityTaskCompletedRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public Void call() throws Exception {
Void result = null;
try {
executeRespondActivityTaskCompleted(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 respondActivityTaskFailedAsync(RespondActivityTaskFailedRequest request) {
return respondActivityTaskFailedAsync(request, null);
}
@Override
public java.util.concurrent.Future respondActivityTaskFailedAsync(final RespondActivityTaskFailedRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final RespondActivityTaskFailedRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public Void call() throws Exception {
Void result = null;
try {
executeRespondActivityTaskFailed(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 respondDecisionTaskCompletedAsync(RespondDecisionTaskCompletedRequest request) {
return respondDecisionTaskCompletedAsync(request, null);
}
@Override
public java.util.concurrent.Future respondDecisionTaskCompletedAsync(final RespondDecisionTaskCompletedRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final RespondDecisionTaskCompletedRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public Void call() throws Exception {
Void result = null;
try {
executeRespondDecisionTaskCompleted(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 signalWorkflowExecutionAsync(SignalWorkflowExecutionRequest request) {
return signalWorkflowExecutionAsync(request, null);
}
@Override
public java.util.concurrent.Future signalWorkflowExecutionAsync(final SignalWorkflowExecutionRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final SignalWorkflowExecutionRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public Void call() throws Exception {
Void result = null;
try {
executeSignalWorkflowExecution(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 startWorkflowExecutionAsync(StartWorkflowExecutionRequest request) {
return startWorkflowExecutionAsync(request, null);
}
@Override
public java.util.concurrent.Future startWorkflowExecutionAsync(final StartWorkflowExecutionRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final StartWorkflowExecutionRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public Run call() throws Exception {
Run result = null;
try {
result = executeStartWorkflowExecution(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 terminateWorkflowExecutionAsync(TerminateWorkflowExecutionRequest request) {
return terminateWorkflowExecutionAsync(request, null);
}
@Override
public java.util.concurrent.Future terminateWorkflowExecutionAsync(final TerminateWorkflowExecutionRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final TerminateWorkflowExecutionRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public Void call() throws Exception {
Void result = null;
try {
executeTerminateWorkflowExecution(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();
}
}