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

com.amazonaws.services.ioteventsdata.AWSIoTEventsDataAsyncClient Maven / Gradle / Ivy

Go to download

The AWS Java SDK for AWS IoT Events Data module holds the client classes that are used for communicating with AWS IoT Events Data Service

There is a newer version: 1.12.772
Show newest version
/*
 * Copyright 2019-2024 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.ioteventsdata;

import javax.annotation.Generated;

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

import java.util.concurrent.ExecutorService;

/**
 * Client for accessing AWS IoT Events Data 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.
 * 

*

* IoT Events monitors your equipment or device fleets for failures or changes in operation, and triggers actions when * such events occur. You can use IoT Events Data API commands to send inputs to detectors, list detectors, and view or * update a detector's status. *

*

* For more information, see What is IoT Events? in * the IoT Events Developer Guide. *

*/ @ThreadSafe @Generated("com.amazonaws:aws-java-sdk-code-generator") public class AWSIoTEventsDataAsyncClient extends AWSIoTEventsDataClient implements AWSIoTEventsDataAsync { private static final int DEFAULT_THREAD_POOL_SIZE = 50; private final java.util.concurrent.ExecutorService executorService; public static AWSIoTEventsDataAsyncClientBuilder asyncBuilder() { return AWSIoTEventsDataAsyncClientBuilder.standard(); } /** * Constructs a new asynchronous client to invoke service methods on AWS IoT Events Data using the specified * parameters. * * @param asyncClientParams * Object providing client parameters. */ AWSIoTEventsDataAsyncClient(AwsAsyncClientParams asyncClientParams) { this(asyncClientParams, false); } /** * Constructs a new asynchronous client to invoke service methods on AWS IoT Events Data using the specified * parameters. * * @param asyncClientParams * Object providing client parameters. * @param endpointDiscoveryEnabled * true will enable endpoint discovery if the service supports it. */ AWSIoTEventsDataAsyncClient(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 batchAcknowledgeAlarmAsync(BatchAcknowledgeAlarmRequest request) { return batchAcknowledgeAlarmAsync(request, null); } @Override public java.util.concurrent.Future batchAcknowledgeAlarmAsync(final BatchAcknowledgeAlarmRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final BatchAcknowledgeAlarmRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public BatchAcknowledgeAlarmResult call() throws Exception { BatchAcknowledgeAlarmResult result = null; try { result = executeBatchAcknowledgeAlarm(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 batchDeleteDetectorAsync(BatchDeleteDetectorRequest request) { return batchDeleteDetectorAsync(request, null); } @Override public java.util.concurrent.Future batchDeleteDetectorAsync(final BatchDeleteDetectorRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final BatchDeleteDetectorRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public BatchDeleteDetectorResult call() throws Exception { BatchDeleteDetectorResult result = null; try { result = executeBatchDeleteDetector(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 batchDisableAlarmAsync(BatchDisableAlarmRequest request) { return batchDisableAlarmAsync(request, null); } @Override public java.util.concurrent.Future batchDisableAlarmAsync(final BatchDisableAlarmRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final BatchDisableAlarmRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public BatchDisableAlarmResult call() throws Exception { BatchDisableAlarmResult result = null; try { result = executeBatchDisableAlarm(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 batchEnableAlarmAsync(BatchEnableAlarmRequest request) { return batchEnableAlarmAsync(request, null); } @Override public java.util.concurrent.Future batchEnableAlarmAsync(final BatchEnableAlarmRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final BatchEnableAlarmRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public BatchEnableAlarmResult call() throws Exception { BatchEnableAlarmResult result = null; try { result = executeBatchEnableAlarm(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 batchPutMessageAsync(BatchPutMessageRequest request) { return batchPutMessageAsync(request, null); } @Override public java.util.concurrent.Future batchPutMessageAsync(final BatchPutMessageRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final BatchPutMessageRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public BatchPutMessageResult call() throws Exception { BatchPutMessageResult result = null; try { result = executeBatchPutMessage(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 batchResetAlarmAsync(BatchResetAlarmRequest request) { return batchResetAlarmAsync(request, null); } @Override public java.util.concurrent.Future batchResetAlarmAsync(final BatchResetAlarmRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final BatchResetAlarmRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public BatchResetAlarmResult call() throws Exception { BatchResetAlarmResult result = null; try { result = executeBatchResetAlarm(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 batchSnoozeAlarmAsync(BatchSnoozeAlarmRequest request) { return batchSnoozeAlarmAsync(request, null); } @Override public java.util.concurrent.Future batchSnoozeAlarmAsync(final BatchSnoozeAlarmRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final BatchSnoozeAlarmRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public BatchSnoozeAlarmResult call() throws Exception { BatchSnoozeAlarmResult result = null; try { result = executeBatchSnoozeAlarm(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 batchUpdateDetectorAsync(BatchUpdateDetectorRequest request) { return batchUpdateDetectorAsync(request, null); } @Override public java.util.concurrent.Future batchUpdateDetectorAsync(final BatchUpdateDetectorRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final BatchUpdateDetectorRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public BatchUpdateDetectorResult call() throws Exception { BatchUpdateDetectorResult result = null; try { result = executeBatchUpdateDetector(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 describeAlarmAsync(DescribeAlarmRequest request) { return describeAlarmAsync(request, null); } @Override public java.util.concurrent.Future describeAlarmAsync(final DescribeAlarmRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final DescribeAlarmRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public DescribeAlarmResult call() throws Exception { DescribeAlarmResult result = null; try { result = executeDescribeAlarm(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 describeDetectorAsync(DescribeDetectorRequest request) { return describeDetectorAsync(request, null); } @Override public java.util.concurrent.Future describeDetectorAsync(final DescribeDetectorRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final DescribeDetectorRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public DescribeDetectorResult call() throws Exception { DescribeDetectorResult result = null; try { result = executeDescribeDetector(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 listAlarmsAsync(ListAlarmsRequest request) { return listAlarmsAsync(request, null); } @Override public java.util.concurrent.Future listAlarmsAsync(final ListAlarmsRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final ListAlarmsRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public ListAlarmsResult call() throws Exception { ListAlarmsResult result = null; try { result = executeListAlarms(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 listDetectorsAsync(ListDetectorsRequest request) { return listDetectorsAsync(request, null); } @Override public java.util.concurrent.Future listDetectorsAsync(final ListDetectorsRequest request, final com.amazonaws.handlers.AsyncHandler asyncHandler) { final ListDetectorsRequest finalRequest = beforeClientExecution(request); return executorService.submit(new java.util.concurrent.Callable() { @Override public ListDetectorsResult call() throws Exception { ListDetectorsResult result = null; try { result = executeListDetectors(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