Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2010-2015 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.importexport;
 
Interface for accessing AWS Import/Export asynchronously. Each asynchronous method will return a Java Future object representing the asynchronous operation; overloads which accept an AsyncHandler can be used to receive notification when an asynchronous operation completes.

<fullname>AWS Import/Export Service</fullname> AWS Import/Export accelerates transferring large amounts of data between the AWS cloud and portable storage devices that you mail to us. AWS Import/Export transfers data directly onto and off of your storage devices using Amazon's high-speed internal network and bypassing the Internet. For large data sets, AWS Import/Export is often faster than Internet transfer and more cost effective than upgrading your connectivity.

 
         implements AmazonImportExportAsync {
 
     private static final int DEFAULT_THREAD_POOL_SIZE = 50;
 
     private final java.util.concurrent.ExecutorService executorService;

    
Constructs a new asynchronous client to invoke service methods on AWS Import/Export. A credentials provider chain will be used that searches for credentials in this order:
  • Environment Variables - AWS_ACCESS_KEY_ID and AWS_SECRET_KEY
  • Java System Properties - aws.accessKeyId and aws.secretKey
  • Credential profiles file at the default location (~/.aws/credentials) shared by all AWS SDKs and the AWS CLI
  • Instance profile credentials delivered through the Amazon EC2 metadata service

Asynchronous methods are delegated to a fixed-size thread pool containing 50 threads (to match the default maximum number of concurrent connections to the service).

 
     public AmazonImportExportAsyncClient() {
         this(new com.amazonaws.auth.DefaultAWSCredentialsProviderChain());
     }

    
Constructs a new asynchronous client to invoke service methods on AWS Import/Export. A credentials provider chain will be used that searches for credentials in this order:
  • Environment Variables - AWS_ACCESS_KEY_ID and AWS_SECRET_KEY
  • Java System Properties - aws.accessKeyId and aws.secretKey
  • Credential profiles file at the default location (~/.aws/credentials) shared by all AWS SDKs and the AWS CLI
  • Instance profile credentials delivered through the Amazon EC2 metadata service

Asynchronous methods are delegated to a fixed-size thread pool containing a number of threads equal to the maximum number of concurrent connections configured via ClientConfiguration.getMaxConnections().

Parameters:
clientConfiguration The client configuration options controlling how this client connects to AWS Import/Export (ex: proxy settings, retry counts, etc).
See also:
com.amazonaws.auth.DefaultAWSCredentialsProviderChain
java.util.concurrent.Executors.newFixedThreadPool(int)
 
             com.amazonaws.ClientConfiguration clientConfiguration) {
                 clientConfiguration, java.util.concurrent.Executors
                         .newFixedThreadPool(clientConfiguration
                                 .getMaxConnections()));
     }

    
Constructs a new asynchronous client to invoke service methods on AWS Import/Export using the specified AWS account credentials.

Asynchronous methods are delegated to a fixed-size thread pool containing 50 threads (to match the default maximum number of concurrent connections to the service).

Parameters:
awsCredentials The AWS credentials (access key ID and secret key) to use when authenticating with AWS services.
See also:
java.util.concurrent.Executors.newFixedThreadPool(int)
            com.amazonaws.auth.AWSCredentials awsCredentials) {
        this(awsCredentials, java.util.concurrent.Executors
                .newFixedThreadPool());
    }

    
Constructs a new asynchronous client to invoke service methods on AWS Import/Export using the specified AWS account credentials and executor service. Default client settings will be used.

Parameters:
awsCredentials The AWS credentials (access key ID and secret key) to use when authenticating with AWS services.
executorService The executor service by which all asynchronous requests will be executed.
            com.amazonaws.auth.AWSCredentials awsCredentials,
            java.util.concurrent.ExecutorService executorService) {
        this(awsCredentialsnew com.amazonaws.ClientConfiguration(),
                executorService);
    }

    
Constructs a new asynchronous client to invoke service methods on AWS Import/Export using the specified AWS account credentials, executor service, and client configuration options.

Parameters:
awsCredentials The AWS credentials (access key ID and secret key) to use when authenticating with AWS services.
clientConfiguration Client configuration options (ex: max retry limit, proxy settings, etc).
executorService The executor service by which all asynchronous requests will be executed.
            com.amazonaws.auth.AWSCredentials awsCredentials,
            com.amazonaws.ClientConfiguration clientConfiguration,
            java.util.concurrent.ExecutorService executorService) {
        super(awsCredentialsclientConfiguration);
        this. = executorService;
    }

    
Constructs a new asynchronous client to invoke service methods on AWS Import/Export using the specified AWS account credentials provider. Default client settings will be used.

Asynchronous methods are delegated to a fixed-size thread pool containing 50 threads (to match the default maximum number of concurrent connections to the service).

Parameters:
awsCredentialsProvider The AWS credentials provider which will provide credentials to authenticate requests with AWS services.
See also:
java.util.concurrent.Executors.newFixedThreadPool(int)
            com.amazonaws.auth.AWSCredentialsProvider awsCredentialsProvider) {
        this(awsCredentialsProvider, java.util.concurrent.Executors
                .newFixedThreadPool());
    }

    
Constructs a new asynchronous client to invoke service methods on AWS Import/Export using the provided AWS account credentials provider and client configuration options.

Asynchronous methods are delegated to a fixed-size thread pool containing a number of threads equal to the maximum number of concurrent connections configured via ClientConfiguration.getMaxConnections().

Parameters:
awsCredentialsProvider The AWS credentials provider which will provide credentials to authenticate requests with AWS services.
clientConfiguration Client configuration options (ex: max retry limit, proxy settings, etc).
See also:
com.amazonaws.auth.DefaultAWSCredentialsProviderChain
java.util.concurrent.Executors.newFixedThreadPool(int)
            com.amazonaws.auth.AWSCredentialsProvider awsCredentialsProvider,
            com.amazonaws.ClientConfiguration clientConfiguration) {
        this(awsCredentialsProviderclientConfiguration,
                java.util.concurrent.Executors
                        .newFixedThreadPool(clientConfiguration
                                .getMaxConnections()));
    }

    
Constructs a new asynchronous client to invoke service methods on AWS Import/Export using the specified AWS account credentials provider and executor service. Default client settings will be used.

Parameters:
awsCredentialsProvider The AWS credentials provider which will provide credentials to authenticate requests with AWS services.
executorService The executor service by which all asynchronous requests will be executed.
            com.amazonaws.auth.AWSCredentialsProvider awsCredentialsProvider,
            java.util.concurrent.ExecutorService executorService) {
        this(awsCredentialsProvidernew com.amazonaws.ClientConfiguration(),
                executorService);
    }

    
Constructs a new asynchronous client to invoke service methods on AWS Import/Export using the specified AWS account credentials provider, executor service, and client configuration options.

Parameters:
awsCredentialsProvider The AWS credentials provider which will provide credentials to authenticate requests with AWS services.
clientConfiguration Client configuration options (ex: max retry limit, proxy settings, etc).
executorService The executor service by which all asynchronous requests will be executed.
            com.amazonaws.auth.AWSCredentialsProvider awsCredentialsProvider,
            com.amazonaws.ClientConfiguration clientConfiguration,
            java.util.concurrent.ExecutorService executorService) {
        super(awsCredentialsProviderclientConfiguration);
        this. = executorService;
    }

    
Returns the executor service used by this client to execute async requests.

Returns:
The executor service used by this client to execute async requests.
        return ;
    }

    
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 getExecutorService().shutdown() followed by getExecutorService().awaitTermination() prior to calling this method.
    @Override
    public void shutdown() {
        super.shutdown();
        .shutdownNow();
    }
    @Override
            final CancelJobRequest cancelJobRequest) {
        return 
                .submit(new java.util.concurrent.Callable<CancelJobResult>() {
                    @Override
                    public CancelJobResult call() {
                        return cancelJob(cancelJobRequest);
                    }
                });
    }
    @Override
            final CancelJobRequest cancelJobRequest,
            final com.amazonaws.handlers.AsyncHandler<CancelJobRequestCancelJobResultasyncHandler) {
        return 
                .submit(new java.util.concurrent.Callable<CancelJobResult>() {
                    @Override
                    public CancelJobResult call() throws Exception {
                        CancelJobResult result;
                        try {
                            result = cancelJob(cancelJobRequest);
                        } catch (Exception ex) {
                            asyncHandler.onError(ex);
                            throw ex;
                        }
                        asyncHandler.onSuccess(cancelJobRequestresult);
                        return result;
                    }
                });
    }
    @Override
            final CreateJobRequest createJobRequest) {
        return 
                .submit(new java.util.concurrent.Callable<CreateJobResult>() {
                    @Override
                    public CreateJobResult call() {
                        return createJob(createJobRequest);
                    }
                });
    }
    @Override
            final CreateJobRequest createJobRequest,
            final com.amazonaws.handlers.AsyncHandler<CreateJobRequestCreateJobResultasyncHandler) {
        return 
                .submit(new java.util.concurrent.Callable<CreateJobResult>() {
                    @Override
                    public CreateJobResult call() throws Exception {
                        CreateJobResult result;
                        try {
                            result = createJob(createJobRequest);
                        } catch (Exception ex) {
                            asyncHandler.onError(ex);
                            throw ex;
                        }
                        asyncHandler.onSuccess(createJobRequestresult);
                        return result;
                    }
                });
    }
    @Override
            final GetShippingLabelRequest getShippingLabelRequest) {
        return 
                .submit(new java.util.concurrent.Callable<GetShippingLabelResult>() {
                    @Override
                    public GetShippingLabelResult call() {
                        return getShippingLabel(getShippingLabelRequest);
                    }
                });
    }
    @Override
            final GetShippingLabelRequest getShippingLabelRequest,
            final com.amazonaws.handlers.AsyncHandler<GetShippingLabelRequestGetShippingLabelResultasyncHandler) {
        return 
                .submit(new java.util.concurrent.Callable<GetShippingLabelResult>() {
                    @Override
                    public GetShippingLabelResult call() throws Exception {
                        GetShippingLabelResult result;
                        try {
                            result = getShippingLabel(getShippingLabelRequest);
                        } catch (Exception ex) {
                            asyncHandler.onError(ex);
                            throw ex;
                        }
                        asyncHandler.onSuccess(getShippingLabelRequestresult);
                        return result;
                    }
                });
    }
    @Override
            final GetStatusRequest getStatusRequest) {
        return 
                .submit(new java.util.concurrent.Callable<GetStatusResult>() {
                    @Override
                    public GetStatusResult call() {
                        return getStatus(getStatusRequest);
                    }
                });
    }
    @Override
            final GetStatusRequest getStatusRequest,
            final com.amazonaws.handlers.AsyncHandler<GetStatusRequestGetStatusResultasyncHandler) {
        return 
                .submit(new java.util.concurrent.Callable<GetStatusResult>() {
                    @Override
                    public GetStatusResult call() throws Exception {
                        GetStatusResult result;
                        try {
                            result = getStatus(getStatusRequest);
                        } catch (Exception ex) {
                            asyncHandler.onError(ex);
                            throw ex;
                        }
                        asyncHandler.onSuccess(getStatusRequestresult);
                        return result;
                    }
                });
    }
    @Override
            final ListJobsRequest listJobsRequest) {
        return 
                .submit(new java.util.concurrent.Callable<ListJobsResult>() {
                    @Override
                    public ListJobsResult call() {
                        return listJobs(listJobsRequest);
                    }
                });
    }
    @Override
            final ListJobsRequest listJobsRequest,
            final com.amazonaws.handlers.AsyncHandler<ListJobsRequestListJobsResultasyncHandler) {
        return 
                .submit(new java.util.concurrent.Callable<ListJobsResult>() {
                    @Override
                    public ListJobsResult call() throws Exception {
                        ListJobsResult result;
                        try {
                            result = listJobs(listJobsRequest);
                        } catch (Exception ex) {
                            asyncHandler.onError(ex);
                            throw ex;
                        }
                        asyncHandler.onSuccess(listJobsRequestresult);
                        return result;
                    }
                });
    }
    @Override
        return listJobsAsync(new ListJobsRequest());
    }

    
Simplified method form for invoking the ListJobs operation with an AsyncHandler.

            com.amazonaws.handlers.AsyncHandler<ListJobsRequestListJobsResultasyncHandler) {
        return listJobsAsync(new ListJobsRequest(), asyncHandler);
    }
    @Override
            final UpdateJobRequest updateJobRequest) {
        return 
                .submit(new java.util.concurrent.Callable<UpdateJobResult>() {
                    @Override
                    public UpdateJobResult call() {
                        return updateJob(updateJobRequest);
                    }
                });
    }
    @Override
            final UpdateJobRequest updateJobRequest,
            final com.amazonaws.handlers.AsyncHandler<UpdateJobRequestUpdateJobResultasyncHandler) {
        return 
                .submit(new java.util.concurrent.Callable<UpdateJobResult>() {
                    @Override
                    public UpdateJobResult call() throws Exception {
                        UpdateJobResult result;
                        try {
                            result = updateJob(updateJobRequest);
                        } catch (Exception ex) {
                            asyncHandler.onError(ex);
                            throw ex;
                        }
                        asyncHandler.onSuccess(updateJobRequestresult);
                        return result;
                    }
                });
    }
New to GrepCode? Check out our FAQ X