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

com.amazonaws.services.simpleworkflow.AmazonSimpleWorkflowAsyncClient Maven / Gradle / Ivy

Go to download

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

There is a newer version: 1.9.13
Show newest version
/*
 * Copyright 2010-2016 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 com.amazonaws.services.simpleworkflow.model.*;
import com.amazonaws.annotation.ThreadSafe;

/**
 * Interface 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 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) */ public AmazonSimpleWorkflowAsyncClient() { this(new com.amazonaws.auth.DefaultAWSCredentialsProviderChain()); } /** * 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) */ public AmazonSimpleWorkflowAsyncClient( com.amazonaws.ClientConfiguration clientConfiguration) { this(new com.amazonaws.auth.DefaultAWSCredentialsProviderChain(), clientConfiguration, java.util.concurrent.Executors .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) */ public AmazonSimpleWorkflowAsyncClient( com.amazonaws.auth.AWSCredentials awsCredentials) { this(awsCredentials, java.util.concurrent.Executors .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. */ public AmazonSimpleWorkflowAsyncClient( com.amazonaws.auth.AWSCredentials awsCredentials, java.util.concurrent.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. */ public AmazonSimpleWorkflowAsyncClient( com.amazonaws.auth.AWSCredentials awsCredentials, com.amazonaws.ClientConfiguration clientConfiguration, java.util.concurrent.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) */ public AmazonSimpleWorkflowAsyncClient( com.amazonaws.auth.AWSCredentialsProvider awsCredentialsProvider) { this(awsCredentialsProvider, java.util.concurrent.Executors .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) */ public AmazonSimpleWorkflowAsyncClient( com.amazonaws.auth.AWSCredentialsProvider awsCredentialsProvider, com.amazonaws.ClientConfiguration clientConfiguration) { this(awsCredentialsProvider, clientConfiguration, java.util.concurrent.Executors .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. */ public AmazonSimpleWorkflowAsyncClient( com.amazonaws.auth.AWSCredentialsProvider awsCredentialsProvider, java.util.concurrent.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. */ public AmazonSimpleWorkflowAsyncClient( com.amazonaws.auth.AWSCredentialsProvider awsCredentialsProvider, com.amazonaws.ClientConfiguration clientConfiguration, java.util.concurrent.ExecutorService executorService) { super(awsCredentialsProvider, clientConfiguration); this.executorService = executorService; } /** * 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 java.util.concurrent.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) { return executorService .submit(new java.util.concurrent.Callable() { @Override public WorkflowExecutionCount call() throws Exception { WorkflowExecutionCount result; try { result = countClosedWorkflowExecutions(request); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(request, 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) { return executorService .submit(new java.util.concurrent.Callable() { @Override public WorkflowExecutionCount call() throws Exception { WorkflowExecutionCount result; try { result = countOpenWorkflowExecutions(request); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(request, 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) { return executorService .submit(new java.util.concurrent.Callable() { @Override public PendingTaskCount call() throws Exception { PendingTaskCount result; try { result = countPendingActivityTasks(request); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(request, 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) { return executorService .submit(new java.util.concurrent.Callable() { @Override public PendingTaskCount call() throws Exception { PendingTaskCount result; try { result = countPendingDecisionTasks(request); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(request, 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) { return executorService .submit(new java.util.concurrent.Callable() { @Override public Void call() throws Exception { Void result; try { deprecateActivityType(request); result = null; } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(request, 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) { return executorService .submit(new java.util.concurrent.Callable() { @Override public Void call() throws Exception { Void result; try { deprecateDomain(request); result = null; } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(request, 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) { return executorService .submit(new java.util.concurrent.Callable() { @Override public Void call() throws Exception { Void result; try { deprecateWorkflowType(request); result = null; } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(request, 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) { return executorService .submit(new java.util.concurrent.Callable() { @Override public ActivityTypeDetail call() throws Exception { ActivityTypeDetail result; try { result = describeActivityType(request); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(request, 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) { return executorService .submit(new java.util.concurrent.Callable() { @Override public DomainDetail call() throws Exception { DomainDetail result; try { result = describeDomain(request); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(request, 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) { return executorService .submit(new java.util.concurrent.Callable() { @Override public WorkflowExecutionDetail call() throws Exception { WorkflowExecutionDetail result; try { result = describeWorkflowExecution(request); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(request, 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) { return executorService .submit(new java.util.concurrent.Callable() { @Override public WorkflowTypeDetail call() throws Exception { WorkflowTypeDetail result; try { result = describeWorkflowType(request); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(request, 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) { return executorService .submit(new java.util.concurrent.Callable() { @Override public History call() throws Exception { History result; try { result = getWorkflowExecutionHistory(request); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(request, 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) { return executorService .submit(new java.util.concurrent.Callable() { @Override public ActivityTypeInfos call() throws Exception { ActivityTypeInfos result; try { result = listActivityTypes(request); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(request, 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) { return executorService .submit(new java.util.concurrent.Callable() { @Override public WorkflowExecutionInfos call() throws Exception { WorkflowExecutionInfos result; try { result = listClosedWorkflowExecutions(request); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(request, 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) { return executorService .submit(new java.util.concurrent.Callable() { @Override public DomainInfos call() throws Exception { DomainInfos result; try { result = listDomains(request); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(request, 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) { return executorService .submit(new java.util.concurrent.Callable() { @Override public WorkflowExecutionInfos call() throws Exception { WorkflowExecutionInfos result; try { result = listOpenWorkflowExecutions(request); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(request, 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) { return executorService .submit(new java.util.concurrent.Callable() { @Override public WorkflowTypeInfos call() throws Exception { WorkflowTypeInfos result; try { result = listWorkflowTypes(request); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(request, 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) { return executorService .submit(new java.util.concurrent.Callable() { @Override public ActivityTask call() throws Exception { ActivityTask result; try { result = pollForActivityTask(request); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(request, 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) { return executorService .submit(new java.util.concurrent.Callable() { @Override public DecisionTask call() throws Exception { DecisionTask result; try { result = pollForDecisionTask(request); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(request, 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) { return executorService .submit(new java.util.concurrent.Callable() { @Override public ActivityTaskStatus call() throws Exception { ActivityTaskStatus result; try { result = recordActivityTaskHeartbeat(request); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(request, 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) { return executorService .submit(new java.util.concurrent.Callable() { @Override public Void call() throws Exception { Void result; try { registerActivityType(request); result = null; } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(request, 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) { return executorService .submit(new java.util.concurrent.Callable() { @Override public Void call() throws Exception { Void result; try { registerDomain(request); result = null; } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(request, 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) { return executorService .submit(new java.util.concurrent.Callable() { @Override public Void call() throws Exception { Void result; try { registerWorkflowType(request); result = null; } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(request, 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) { return executorService .submit(new java.util.concurrent.Callable() { @Override public Void call() throws Exception { Void result; try { requestCancelWorkflowExecution(request); result = null; } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(request, 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) { return executorService .submit(new java.util.concurrent.Callable() { @Override public Void call() throws Exception { Void result; try { respondActivityTaskCanceled(request); result = null; } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(request, 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) { return executorService .submit(new java.util.concurrent.Callable() { @Override public Void call() throws Exception { Void result; try { respondActivityTaskCompleted(request); result = null; } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(request, 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) { return executorService .submit(new java.util.concurrent.Callable() { @Override public Void call() throws Exception { Void result; try { respondActivityTaskFailed(request); result = null; } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(request, 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) { return executorService .submit(new java.util.concurrent.Callable() { @Override public Void call() throws Exception { Void result; try { respondDecisionTaskCompleted(request); result = null; } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(request, 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) { return executorService .submit(new java.util.concurrent.Callable() { @Override public Void call() throws Exception { Void result; try { signalWorkflowExecution(request); result = null; } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(request, 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) { return executorService.submit(new java.util.concurrent.Callable() { @Override public Run call() throws Exception { Run result; try { result = startWorkflowExecution(request); } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(request, 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) { return executorService .submit(new java.util.concurrent.Callable() { @Override public Void call() throws Exception { Void result; try { terminateWorkflowExecution(request); result = null; } catch (Exception ex) { if (asyncHandler != null) { asyncHandler.onError(ex); } throw ex; } if (asyncHandler != null) { asyncHandler.onSuccess(request, 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