com.amazonaws.services.iotevents.AWSIoTEventsAsyncClient Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aws-java-sdk-iotevents Show documentation
Show all versions of aws-java-sdk-iotevents Show documentation
The AWS Java SDK for AWS IoT Events module holds the client classes that are used for communicating with AWS IoT Events Service
/*
* Copyright 2015-2020 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.iotevents;
import javax.annotation.Generated;
import com.amazonaws.services.iotevents.model.*;
import com.amazonaws.client.AwsAsyncClientParams;
import com.amazonaws.annotation.ThreadSafe;
import java.util.concurrent.ExecutorService;
/**
* Client for accessing AWS IoT Events 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.
*
*
* AWS IoT Events monitors your equipment or device fleets for failures or changes in operation, and triggers actions
* when such events occur. You can use AWS IoT Events API operations to create, read, update, and delete inputs and
* detector models, and to list their versions.
*
*/
@ThreadSafe
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class AWSIoTEventsAsyncClient extends AWSIoTEventsClient implements AWSIoTEventsAsync {
private static final int DEFAULT_THREAD_POOL_SIZE = 50;
private final java.util.concurrent.ExecutorService executorService;
public static AWSIoTEventsAsyncClientBuilder asyncBuilder() {
return AWSIoTEventsAsyncClientBuilder.standard();
}
/**
* Constructs a new asynchronous client to invoke service methods on AWS IoT Events using the specified parameters.
*
* @param asyncClientParams
* Object providing client parameters.
*/
AWSIoTEventsAsyncClient(AwsAsyncClientParams asyncClientParams) {
this(asyncClientParams, false);
}
/**
* Constructs a new asynchronous client to invoke service methods on AWS IoT Events using the specified parameters.
*
* @param asyncClientParams
* Object providing client parameters.
* @param endpointDiscoveryEnabled
* true will enable endpoint discovery if the service supports it.
*/
AWSIoTEventsAsyncClient(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 createDetectorModelAsync(CreateDetectorModelRequest request) {
return createDetectorModelAsync(request, null);
}
@Override
public java.util.concurrent.Future createDetectorModelAsync(final CreateDetectorModelRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final CreateDetectorModelRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public CreateDetectorModelResult call() throws Exception {
CreateDetectorModelResult result = null;
try {
result = executeCreateDetectorModel(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 createInputAsync(CreateInputRequest request) {
return createInputAsync(request, null);
}
@Override
public java.util.concurrent.Future createInputAsync(final CreateInputRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final CreateInputRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public CreateInputResult call() throws Exception {
CreateInputResult result = null;
try {
result = executeCreateInput(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 deleteDetectorModelAsync(DeleteDetectorModelRequest request) {
return deleteDetectorModelAsync(request, null);
}
@Override
public java.util.concurrent.Future deleteDetectorModelAsync(final DeleteDetectorModelRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DeleteDetectorModelRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DeleteDetectorModelResult call() throws Exception {
DeleteDetectorModelResult result = null;
try {
result = executeDeleteDetectorModel(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 deleteInputAsync(DeleteInputRequest request) {
return deleteInputAsync(request, null);
}
@Override
public java.util.concurrent.Future deleteInputAsync(final DeleteInputRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DeleteInputRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DeleteInputResult call() throws Exception {
DeleteInputResult result = null;
try {
result = executeDeleteInput(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 describeDetectorModelAsync(DescribeDetectorModelRequest request) {
return describeDetectorModelAsync(request, null);
}
@Override
public java.util.concurrent.Future describeDetectorModelAsync(final DescribeDetectorModelRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DescribeDetectorModelRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DescribeDetectorModelResult call() throws Exception {
DescribeDetectorModelResult result = null;
try {
result = executeDescribeDetectorModel(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 describeInputAsync(DescribeInputRequest request) {
return describeInputAsync(request, null);
}
@Override
public java.util.concurrent.Future describeInputAsync(final DescribeInputRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DescribeInputRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DescribeInputResult call() throws Exception {
DescribeInputResult result = null;
try {
result = executeDescribeInput(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 describeLoggingOptionsAsync(DescribeLoggingOptionsRequest request) {
return describeLoggingOptionsAsync(request, null);
}
@Override
public java.util.concurrent.Future describeLoggingOptionsAsync(final DescribeLoggingOptionsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DescribeLoggingOptionsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DescribeLoggingOptionsResult call() throws Exception {
DescribeLoggingOptionsResult result = null;
try {
result = executeDescribeLoggingOptions(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 listDetectorModelVersionsAsync(ListDetectorModelVersionsRequest request) {
return listDetectorModelVersionsAsync(request, null);
}
@Override
public java.util.concurrent.Future listDetectorModelVersionsAsync(final ListDetectorModelVersionsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListDetectorModelVersionsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListDetectorModelVersionsResult call() throws Exception {
ListDetectorModelVersionsResult result = null;
try {
result = executeListDetectorModelVersions(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 listDetectorModelsAsync(ListDetectorModelsRequest request) {
return listDetectorModelsAsync(request, null);
}
@Override
public java.util.concurrent.Future listDetectorModelsAsync(final ListDetectorModelsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListDetectorModelsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListDetectorModelsResult call() throws Exception {
ListDetectorModelsResult result = null;
try {
result = executeListDetectorModels(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 listInputsAsync(ListInputsRequest request) {
return listInputsAsync(request, null);
}
@Override
public java.util.concurrent.Future listInputsAsync(final ListInputsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListInputsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListInputsResult call() throws Exception {
ListInputsResult result = null;
try {
result = executeListInputs(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 listTagsForResourceAsync(ListTagsForResourceRequest request) {
return listTagsForResourceAsync(request, null);
}
@Override
public java.util.concurrent.Future listTagsForResourceAsync(final ListTagsForResourceRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListTagsForResourceRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListTagsForResourceResult call() throws Exception {
ListTagsForResourceResult result = null;
try {
result = executeListTagsForResource(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 putLoggingOptionsAsync(PutLoggingOptionsRequest request) {
return putLoggingOptionsAsync(request, null);
}
@Override
public java.util.concurrent.Future putLoggingOptionsAsync(final PutLoggingOptionsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final PutLoggingOptionsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public PutLoggingOptionsResult call() throws Exception {
PutLoggingOptionsResult result = null;
try {
result = executePutLoggingOptions(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 tagResourceAsync(TagResourceRequest request) {
return tagResourceAsync(request, null);
}
@Override
public java.util.concurrent.Future tagResourceAsync(final TagResourceRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final TagResourceRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public TagResourceResult call() throws Exception {
TagResourceResult result = null;
try {
result = executeTagResource(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future untagResourceAsync(UntagResourceRequest request) {
return untagResourceAsync(request, null);
}
@Override
public java.util.concurrent.Future untagResourceAsync(final UntagResourceRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final UntagResourceRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public UntagResourceResult call() throws Exception {
UntagResourceResult result = null;
try {
result = executeUntagResource(finalRequest);
} catch (Exception ex) {
if (asyncHandler != null) {
asyncHandler.onError(ex);
}
throw ex;
}
if (asyncHandler != null) {
asyncHandler.onSuccess(finalRequest, result);
}
return result;
}
});
}
@Override
public java.util.concurrent.Future updateDetectorModelAsync(UpdateDetectorModelRequest request) {
return updateDetectorModelAsync(request, null);
}
@Override
public java.util.concurrent.Future updateDetectorModelAsync(final UpdateDetectorModelRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final UpdateDetectorModelRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public UpdateDetectorModelResult call() throws Exception {
UpdateDetectorModelResult result = null;
try {
result = executeUpdateDetectorModel(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 updateInputAsync(UpdateInputRequest request) {
return updateInputAsync(request, null);
}
@Override
public java.util.concurrent.Future updateInputAsync(final UpdateInputRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final UpdateInputRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public UpdateInputResult call() throws Exception {
UpdateInputResult result = null;
try {
result = executeUpdateInput(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 - 2025 Weber Informatics LLC | Privacy Policy