com.amazonaws.services.simspaceweaver.AWSSimSpaceWeaverAsyncClient Maven / Gradle / Ivy
Show all versions of aws-java-sdk-simspaceweaver Show documentation
/*
* 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.simspaceweaver;
import javax.annotation.Generated;
import com.amazonaws.services.simspaceweaver.model.*;
import com.amazonaws.client.AwsAsyncClientParams;
import com.amazonaws.annotation.ThreadSafe;
import java.util.concurrent.ExecutorService;
/**
* Client for accessing AWS SimSpace Weaver 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.
*
*
* SimSpace Weaver (SimSpace Weaver) is a service that you can use to build and run large-scale spatial simulations in
* the Amazon Web Services Cloud. For example, you can create crowd simulations, large real-world environments, and
* immersive and interactive experiences. For more information about SimSpace Weaver, see the SimSpace Weaver User Guide .
*
*
* This API reference describes the API operations and data types that you can use to communicate directly with SimSpace
* Weaver.
*
*
* SimSpace Weaver also provides the SimSpace Weaver app SDK, which you use for app development. The SimSpace Weaver app
* SDK API reference is included in the SimSpace Weaver app SDK documentation. This documentation is part of the
* SimSpace Weaver app SDK distributable package.
*
*/
@ThreadSafe
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class AWSSimSpaceWeaverAsyncClient extends AWSSimSpaceWeaverClient implements AWSSimSpaceWeaverAsync {
private static final int DEFAULT_THREAD_POOL_SIZE = 50;
private final java.util.concurrent.ExecutorService executorService;
public static AWSSimSpaceWeaverAsyncClientBuilder asyncBuilder() {
return AWSSimSpaceWeaverAsyncClientBuilder.standard();
}
/**
* Constructs a new asynchronous client to invoke service methods on AWS SimSpace Weaver using the specified
* parameters.
*
* @param asyncClientParams
* Object providing client parameters.
*/
AWSSimSpaceWeaverAsyncClient(AwsAsyncClientParams asyncClientParams) {
this(asyncClientParams, false);
}
/**
* Constructs a new asynchronous client to invoke service methods on AWS SimSpace Weaver using the specified
* parameters.
*
* @param asyncClientParams
* Object providing client parameters.
* @param endpointDiscoveryEnabled
* true will enable endpoint discovery if the service supports it.
*/
AWSSimSpaceWeaverAsyncClient(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 createSnapshotAsync(CreateSnapshotRequest request) {
return createSnapshotAsync(request, null);
}
@Override
public java.util.concurrent.Future createSnapshotAsync(final CreateSnapshotRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final CreateSnapshotRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public CreateSnapshotResult call() throws Exception {
CreateSnapshotResult result = null;
try {
result = executeCreateSnapshot(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 deleteAppAsync(DeleteAppRequest request) {
return deleteAppAsync(request, null);
}
@Override
public java.util.concurrent.Future deleteAppAsync(final DeleteAppRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DeleteAppRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DeleteAppResult call() throws Exception {
DeleteAppResult result = null;
try {
result = executeDeleteApp(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 deleteSimulationAsync(DeleteSimulationRequest request) {
return deleteSimulationAsync(request, null);
}
@Override
public java.util.concurrent.Future deleteSimulationAsync(final DeleteSimulationRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DeleteSimulationRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DeleteSimulationResult call() throws Exception {
DeleteSimulationResult result = null;
try {
result = executeDeleteSimulation(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 describeAppAsync(DescribeAppRequest request) {
return describeAppAsync(request, null);
}
@Override
public java.util.concurrent.Future describeAppAsync(final DescribeAppRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DescribeAppRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DescribeAppResult call() throws Exception {
DescribeAppResult result = null;
try {
result = executeDescribeApp(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 describeSimulationAsync(DescribeSimulationRequest request) {
return describeSimulationAsync(request, null);
}
@Override
public java.util.concurrent.Future describeSimulationAsync(final DescribeSimulationRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final DescribeSimulationRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public DescribeSimulationResult call() throws Exception {
DescribeSimulationResult result = null;
try {
result = executeDescribeSimulation(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 listAppsAsync(ListAppsRequest request) {
return listAppsAsync(request, null);
}
@Override
public java.util.concurrent.Future listAppsAsync(final ListAppsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListAppsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListAppsResult call() throws Exception {
ListAppsResult result = null;
try {
result = executeListApps(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 listSimulationsAsync(ListSimulationsRequest request) {
return listSimulationsAsync(request, null);
}
@Override
public java.util.concurrent.Future listSimulationsAsync(final ListSimulationsRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final ListSimulationsRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public ListSimulationsResult call() throws Exception {
ListSimulationsResult result = null;
try {
result = executeListSimulations(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 startAppAsync(StartAppRequest request) {
return startAppAsync(request, null);
}
@Override
public java.util.concurrent.Future startAppAsync(final StartAppRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final StartAppRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public StartAppResult call() throws Exception {
StartAppResult result = null;
try {
result = executeStartApp(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 startClockAsync(StartClockRequest request) {
return startClockAsync(request, null);
}
@Override
public java.util.concurrent.Future startClockAsync(final StartClockRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final StartClockRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public StartClockResult call() throws Exception {
StartClockResult result = null;
try {
result = executeStartClock(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 startSimulationAsync(StartSimulationRequest request) {
return startSimulationAsync(request, null);
}
@Override
public java.util.concurrent.Future startSimulationAsync(final StartSimulationRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final StartSimulationRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public StartSimulationResult call() throws Exception {
StartSimulationResult result = null;
try {
result = executeStartSimulation(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 stopAppAsync(StopAppRequest request) {
return stopAppAsync(request, null);
}
@Override
public java.util.concurrent.Future stopAppAsync(final StopAppRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final StopAppRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public StopAppResult call() throws Exception {
StopAppResult result = null;
try {
result = executeStopApp(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 stopClockAsync(StopClockRequest request) {
return stopClockAsync(request, null);
}
@Override
public java.util.concurrent.Future stopClockAsync(final StopClockRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final StopClockRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public StopClockResult call() throws Exception {
StopClockResult result = null;
try {
result = executeStopClock(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 stopSimulationAsync(StopSimulationRequest request) {
return stopSimulationAsync(request, null);
}
@Override
public java.util.concurrent.Future stopSimulationAsync(final StopSimulationRequest request,
final com.amazonaws.handlers.AsyncHandler asyncHandler) {
final StopSimulationRequest finalRequest = beforeClientExecution(request);
return executorService.submit(new java.util.concurrent.Callable() {
@Override
public StopSimulationResult call() throws Exception {
StopSimulationResult result = null;
try {
result = executeStopSimulation(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;
}
});
}
/**
* 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();
}
}