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

com.amazonaws.services.mturk.AmazonMTurkAsyncClient Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon Mechanical Turk module holds the client classes that are used for communicating with Amazon Mechanical Turk Requester.

There is a newer version: 1.12.772
Show newest version
/*
 * Copyright 2016-2021 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.mturk;

import javax.annotation.Generated;

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

import java.util.concurrent.ExecutorService;

/**
 * Client for accessing Amazon MTurk 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 Mechanical Turk API Reference */ @ThreadSafe @Generated("com.amazonaws:aws-java-sdk-code-generator") public class AmazonMTurkAsyncClient extends AmazonMTurkClient implements AmazonMTurkAsync { private static final int DEFAULT_THREAD_POOL_SIZE = 50; private final java.util.concurrent.ExecutorService executorService; public static AmazonMTurkAsyncClientBuilder asyncBuilder() { return AmazonMTurkAsyncClientBuilder.standard(); } /** * Constructs a new asynchronous client to invoke service methods on Amazon MTurk using the specified parameters. * * @param asyncClientParams * Object providing client parameters. */ AmazonMTurkAsyncClient(AwsAsyncClientParams asyncClientParams) { this(asyncClientParams, false); } /** * Constructs a new asynchronous client to invoke service methods on Amazon MTurk using the specified parameters. * * @param asyncClientParams * Object providing client parameters. * @param endpointDiscoveryEnabled * true will enable endpoint discovery if the service supports it. */ AmazonMTurkAsyncClient(AwsAsyncClientParams asyncClientParams, boolean endpointDiscoveryEnabled) { super(asyncClientParams, endpointDiscoveryEnabled); this.executorService = asyncClientParams.getExecutor(); } /** * Returns the executor service used by this client to execute async requests. * * @return The executor service used by this client to execute async requests. */ public ExecutorService getExecutorService() { return executorService; } @Override public java.util.concurrent.Future acceptQualificationRequestAsync(AcceptQualificationRequestRequest request) { return acceptQualificationRequestAsync(request, null); } @Override public java.util.concurrent.Future acceptQualificationRequestAsync(final AcceptQualificationRequestRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final AcceptQualificationRequestRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public AcceptQualificationRequestResult call() throws Exception { AcceptQualificationRequestResult result = null; try { result = executeAcceptQualificationRequest(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 approveAssignmentAsync(ApproveAssignmentRequest request) { return approveAssignmentAsync(request, null); } @Override public java.util.concurrent.Future approveAssignmentAsync(final ApproveAssignmentRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final ApproveAssignmentRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public ApproveAssignmentResult call() throws Exception { ApproveAssignmentResult result = null; try { result = executeApproveAssignment(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 associateQualificationWithWorkerAsync( AssociateQualificationWithWorkerRequest request) { return associateQualificationWithWorkerAsync(request, null); } @Override public java.util.concurrent.Future associateQualificationWithWorkerAsync( final AssociateQualificationWithWorkerRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final AssociateQualificationWithWorkerRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public AssociateQualificationWithWorkerResult call() throws Exception { AssociateQualificationWithWorkerResult result = null; try { result = executeAssociateQualificationWithWorker(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 createAdditionalAssignmentsForHITAsync( CreateAdditionalAssignmentsForHITRequest request) { return createAdditionalAssignmentsForHITAsync(request, null); } @Override public java.util.concurrent.Future createAdditionalAssignmentsForHITAsync( final CreateAdditionalAssignmentsForHITRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final CreateAdditionalAssignmentsForHITRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public CreateAdditionalAssignmentsForHITResult call() throws Exception { CreateAdditionalAssignmentsForHITResult result = null; try { result = executeCreateAdditionalAssignmentsForHIT(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 createHITAsync(CreateHITRequest request) { return createHITAsync(request, null); } @Override public java.util.concurrent.Future createHITAsync(final CreateHITRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final CreateHITRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public CreateHITResult call() throws Exception { CreateHITResult result = null; try { result = executeCreateHIT(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 createHITTypeAsync(CreateHITTypeRequest request) { return createHITTypeAsync(request, null); } @Override public java.util.concurrent.Future createHITTypeAsync(final CreateHITTypeRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final CreateHITTypeRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public CreateHITTypeResult call() throws Exception { CreateHITTypeResult result = null; try { result = executeCreateHITType(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 createHITWithHITTypeAsync(CreateHITWithHITTypeRequest request) { return createHITWithHITTypeAsync(request, null); } @Override public java.util.concurrent.Future createHITWithHITTypeAsync(final CreateHITWithHITTypeRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final CreateHITWithHITTypeRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public CreateHITWithHITTypeResult call() throws Exception { CreateHITWithHITTypeResult result = null; try { result = executeCreateHITWithHITType(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 createQualificationTypeAsync(CreateQualificationTypeRequest request) { return createQualificationTypeAsync(request, null); } @Override public java.util.concurrent.Future createQualificationTypeAsync(final CreateQualificationTypeRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final CreateQualificationTypeRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public CreateQualificationTypeResult call() throws Exception { CreateQualificationTypeResult result = null; try { result = executeCreateQualificationType(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 createWorkerBlockAsync(CreateWorkerBlockRequest request) { return createWorkerBlockAsync(request, null); } @Override public java.util.concurrent.Future createWorkerBlockAsync(final CreateWorkerBlockRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final CreateWorkerBlockRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public CreateWorkerBlockResult call() throws Exception { CreateWorkerBlockResult result = null; try { result = executeCreateWorkerBlock(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 deleteHITAsync(DeleteHITRequest request) { return deleteHITAsync(request, null); } @Override public java.util.concurrent.Future deleteHITAsync(final DeleteHITRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final DeleteHITRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public DeleteHITResult call() throws Exception { DeleteHITResult result = null; try { result = executeDeleteHIT(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 deleteQualificationTypeAsync(DeleteQualificationTypeRequest request) { return deleteQualificationTypeAsync(request, null); } @Override public java.util.concurrent.Future deleteQualificationTypeAsync(final DeleteQualificationTypeRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final DeleteQualificationTypeRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public DeleteQualificationTypeResult call() throws Exception { DeleteQualificationTypeResult result = null; try { result = executeDeleteQualificationType(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 deleteWorkerBlockAsync(DeleteWorkerBlockRequest request) { return deleteWorkerBlockAsync(request, null); } @Override public java.util.concurrent.Future deleteWorkerBlockAsync(final DeleteWorkerBlockRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final DeleteWorkerBlockRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public DeleteWorkerBlockResult call() throws Exception { DeleteWorkerBlockResult result = null; try { result = executeDeleteWorkerBlock(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 disassociateQualificationFromWorkerAsync( DisassociateQualificationFromWorkerRequest request) { return disassociateQualificationFromWorkerAsync(request, null); } @Override public java.util.concurrent.Future disassociateQualificationFromWorkerAsync( final DisassociateQualificationFromWorkerRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final DisassociateQualificationFromWorkerRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public DisassociateQualificationFromWorkerResult call() throws Exception { DisassociateQualificationFromWorkerResult result = null; try { result = executeDisassociateQualificationFromWorker(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 getAccountBalanceAsync(GetAccountBalanceRequest request) { return getAccountBalanceAsync(request, null); } @Override public java.util.concurrent.Future getAccountBalanceAsync(final GetAccountBalanceRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final GetAccountBalanceRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public GetAccountBalanceResult call() throws Exception { GetAccountBalanceResult result = null; try { result = executeGetAccountBalance(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 getAssignmentAsync(GetAssignmentRequest request) { return getAssignmentAsync(request, null); } @Override public java.util.concurrent.Future getAssignmentAsync(final GetAssignmentRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final GetAssignmentRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public GetAssignmentResult call() throws Exception { GetAssignmentResult result = null; try { result = executeGetAssignment(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 getFileUploadURLAsync(GetFileUploadURLRequest request) { return getFileUploadURLAsync(request, null); } @Override public java.util.concurrent.Future getFileUploadURLAsync(final GetFileUploadURLRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final GetFileUploadURLRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public GetFileUploadURLResult call() throws Exception { GetFileUploadURLResult result = null; try { result = executeGetFileUploadURL(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 getHITAsync(GetHITRequest request) { return getHITAsync(request, null); } @Override public java.util.concurrent.Future getHITAsync(final GetHITRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final GetHITRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public GetHITResult call() throws Exception { GetHITResult result = null; try { result = executeGetHIT(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 getQualificationScoreAsync(GetQualificationScoreRequest request) { return getQualificationScoreAsync(request, null); } @Override public java.util.concurrent.Future getQualificationScoreAsync(final GetQualificationScoreRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final GetQualificationScoreRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public GetQualificationScoreResult call() throws Exception { GetQualificationScoreResult result = null; try { result = executeGetQualificationScore(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 getQualificationTypeAsync(GetQualificationTypeRequest request) { return getQualificationTypeAsync(request, null); } @Override public java.util.concurrent.Future getQualificationTypeAsync(final GetQualificationTypeRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final GetQualificationTypeRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public GetQualificationTypeResult call() throws Exception { GetQualificationTypeResult result = null; try { result = executeGetQualificationType(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 listAssignmentsForHITAsync(ListAssignmentsForHITRequest request) { return listAssignmentsForHITAsync(request, null); } @Override public java.util.concurrent.Future listAssignmentsForHITAsync(final ListAssignmentsForHITRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final ListAssignmentsForHITRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public ListAssignmentsForHITResult call() throws Exception { ListAssignmentsForHITResult result = null; try { result = executeListAssignmentsForHIT(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 listBonusPaymentsAsync(ListBonusPaymentsRequest request) { return listBonusPaymentsAsync(request, null); } @Override public java.util.concurrent.Future listBonusPaymentsAsync(final ListBonusPaymentsRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final ListBonusPaymentsRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public ListBonusPaymentsResult call() throws Exception { ListBonusPaymentsResult result = null; try { result = executeListBonusPayments(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 listHITsAsync(ListHITsRequest request) { return listHITsAsync(request, null); } @Override public java.util.concurrent.Future listHITsAsync(final ListHITsRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final ListHITsRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public ListHITsResult call() throws Exception { ListHITsResult result = null; try { result = executeListHITs(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 listHITsForQualificationTypeAsync(ListHITsForQualificationTypeRequest request) { return listHITsForQualificationTypeAsync(request, null); } @Override public java.util.concurrent.Future listHITsForQualificationTypeAsync(final ListHITsForQualificationTypeRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final ListHITsForQualificationTypeRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public ListHITsForQualificationTypeResult call() throws Exception { ListHITsForQualificationTypeResult result = null; try { result = executeListHITsForQualificationType(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 listQualificationRequestsAsync(ListQualificationRequestsRequest request) { return listQualificationRequestsAsync(request, null); } @Override public java.util.concurrent.Future listQualificationRequestsAsync(final ListQualificationRequestsRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final ListQualificationRequestsRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public ListQualificationRequestsResult call() throws Exception { ListQualificationRequestsResult result = null; try { result = executeListQualificationRequests(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 listQualificationTypesAsync(ListQualificationTypesRequest request) { return listQualificationTypesAsync(request, null); } @Override public java.util.concurrent.Future listQualificationTypesAsync(final ListQualificationTypesRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final ListQualificationTypesRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public ListQualificationTypesResult call() throws Exception { ListQualificationTypesResult result = null; try { result = executeListQualificationTypes(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 listReviewPolicyResultsForHITAsync(ListReviewPolicyResultsForHITRequest request) { return listReviewPolicyResultsForHITAsync(request, null); } @Override public java.util.concurrent.Future listReviewPolicyResultsForHITAsync( final ListReviewPolicyResultsForHITRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final ListReviewPolicyResultsForHITRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public ListReviewPolicyResultsForHITResult call() throws Exception { ListReviewPolicyResultsForHITResult result = null; try { result = executeListReviewPolicyResultsForHIT(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 listReviewableHITsAsync(ListReviewableHITsRequest request) { return listReviewableHITsAsync(request, null); } @Override public java.util.concurrent.Future listReviewableHITsAsync(final ListReviewableHITsRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final ListReviewableHITsRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public ListReviewableHITsResult call() throws Exception { ListReviewableHITsResult result = null; try { result = executeListReviewableHITs(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 listWorkerBlocksAsync(ListWorkerBlocksRequest request) { return listWorkerBlocksAsync(request, null); } @Override public java.util.concurrent.Future listWorkerBlocksAsync(final ListWorkerBlocksRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final ListWorkerBlocksRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public ListWorkerBlocksResult call() throws Exception { ListWorkerBlocksResult result = null; try { result = executeListWorkerBlocks(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 listWorkersWithQualificationTypeAsync( ListWorkersWithQualificationTypeRequest request) { return listWorkersWithQualificationTypeAsync(request, null); } @Override public java.util.concurrent.Future listWorkersWithQualificationTypeAsync( final ListWorkersWithQualificationTypeRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final ListWorkersWithQualificationTypeRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public ListWorkersWithQualificationTypeResult call() throws Exception { ListWorkersWithQualificationTypeResult result = null; try { result = executeListWorkersWithQualificationType(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 notifyWorkersAsync(NotifyWorkersRequest request) { return notifyWorkersAsync(request, null); } @Override public java.util.concurrent.Future notifyWorkersAsync(final NotifyWorkersRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final NotifyWorkersRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public NotifyWorkersResult call() throws Exception { NotifyWorkersResult result = null; try { result = executeNotifyWorkers(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 rejectAssignmentAsync(RejectAssignmentRequest request) { return rejectAssignmentAsync(request, null); } @Override public java.util.concurrent.Future rejectAssignmentAsync(final RejectAssignmentRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final RejectAssignmentRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public RejectAssignmentResult call() throws Exception { RejectAssignmentResult result = null; try { result = executeRejectAssignment(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 rejectQualificationRequestAsync(RejectQualificationRequestRequest request) { return rejectQualificationRequestAsync(request, null); } @Override public java.util.concurrent.Future rejectQualificationRequestAsync(final RejectQualificationRequestRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final RejectQualificationRequestRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public RejectQualificationRequestResult call() throws Exception { RejectQualificationRequestResult result = null; try { result = executeRejectQualificationRequest(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 sendBonusAsync(SendBonusRequest request) { return sendBonusAsync(request, null); } @Override public java.util.concurrent.Future sendBonusAsync(final SendBonusRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final SendBonusRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public SendBonusResult call() throws Exception { SendBonusResult result = null; try { result = executeSendBonus(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 sendTestEventNotificationAsync(SendTestEventNotificationRequest request) { return sendTestEventNotificationAsync(request, null); } @Override public java.util.concurrent.Future sendTestEventNotificationAsync(final SendTestEventNotificationRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final SendTestEventNotificationRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public SendTestEventNotificationResult call() throws Exception { SendTestEventNotificationResult result = null; try { result = executeSendTestEventNotification(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 updateExpirationForHITAsync(UpdateExpirationForHITRequest request) { return updateExpirationForHITAsync(request, null); } @Override public java.util.concurrent.Future updateExpirationForHITAsync(final UpdateExpirationForHITRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final UpdateExpirationForHITRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public UpdateExpirationForHITResult call() throws Exception { UpdateExpirationForHITResult result = null; try { result = executeUpdateExpirationForHIT(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 updateHITReviewStatusAsync(UpdateHITReviewStatusRequest request) { return updateHITReviewStatusAsync(request, null); } @Override public java.util.concurrent.Future updateHITReviewStatusAsync(final UpdateHITReviewStatusRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final UpdateHITReviewStatusRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public UpdateHITReviewStatusResult call() throws Exception { UpdateHITReviewStatusResult result = null; try { result = executeUpdateHITReviewStatus(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 updateHITTypeOfHITAsync(UpdateHITTypeOfHITRequest request) { return updateHITTypeOfHITAsync(request, null); } @Override public java.util.concurrent.Future updateHITTypeOfHITAsync(final UpdateHITTypeOfHITRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final UpdateHITTypeOfHITRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public UpdateHITTypeOfHITResult call() throws Exception { UpdateHITTypeOfHITResult result = null; try { result = executeUpdateHITTypeOfHIT(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 updateNotificationSettingsAsync(UpdateNotificationSettingsRequest request) { return updateNotificationSettingsAsync(request, null); } @Override public java.util.concurrent.Future updateNotificationSettingsAsync(final UpdateNotificationSettingsRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final UpdateNotificationSettingsRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public UpdateNotificationSettingsResult call() throws Exception { UpdateNotificationSettingsResult result = null; try { result = executeUpdateNotificationSettings(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 updateQualificationTypeAsync(UpdateQualificationTypeRequest request) { return updateQualificationTypeAsync(request, null); } @Override public java.util.concurrent.Future updateQualificationTypeAsync(final UpdateQualificationTypeRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final UpdateQualificationTypeRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public UpdateQualificationTypeResult call() throws Exception { UpdateQualificationTypeResult result = null; try { result = executeUpdateQualificationType(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