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

macros.asyncclientclass.ClientMethodForOperation.ftl Maven / Gradle / Ivy

Go to download

The AWS SDK for Java - Code Generator module holds the classes and templates required to generate the AWS Java SDK clients for AWS services.

There is a newer version: 1.11.8
Show newest version
<#macro content operation>

@Override
<#if operation.deprecated>
  @Deprecated

public ${operation.asyncFutureType} ${operation.methodName}Async(
        ${operation.input.variableType} request) {

    return ${operation.methodName}Async(request, null);
}

@Override
<#if operation.deprecated>
  @Deprecated

public ${operation.asyncFutureType} ${operation.methodName}Async(
    final ${operation.input.variableType} request,
    final ${operation.asyncHandlerType} asyncHandler) {

    return executorService.submit(new ${operation.asyncCallableType}() {
        @Override
        public ${operation.asyncReturnType} call() throws Exception {
            ${operation.asyncReturnType} result;

            try {
              <#if operation.returnType??>
                result = ${operation.methodName}(request);
              <#else>
                ${operation.methodName}(request);
                result = null;
              
            } catch (Exception ex) {
                if (asyncHandler != null) {
                    asyncHandler.onError(ex);
                }
                throw ex;
            }

            if (asyncHandler != null) {
                asyncHandler.onSuccess(request, result);
            }
            return result;
        }
    });
}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy