Example usage for com.amazonaws.services.glacier AmazonGlacierAsyncClient describeJob

List of usage examples for com.amazonaws.services.glacier AmazonGlacierAsyncClient describeJob

Introduction

In this page you can find the example usage for com.amazonaws.services.glacier AmazonGlacierAsyncClient describeJob.

Prototype

DescribeJobResult describeJob(DescribeJobRequest describeJobRequest);

Source Link

Document

This operation returns information about a job you previously initiated, including the job initiation date, the user who initiated the job, the job status code/message and the Amazon SNS topic to notify after Amazon S3 Glacier (Glacier) completes the job.

Usage

From source file:opendap.aws.glacier.Download.java

License:Open Source License

public boolean jobCompleted() throws IOException {

    _log.debug("archiveRetrievalJobCompleted() - BEGIN ");

    if (!_started)
        throw new IOException("Glacier retrieval job has NOT been started!");

    AmazonGlacierAsyncClient client = new AmazonGlacierAsyncClient(getCredentials());
    client.setEndpoint(getEndpointUrl());

    InitiateJobResult initiateJobResult = getInitiateJobResult();

    long timeRemaining = estimatedTimeRemaining();

    _log.debug("archiveRetrievalJobCompleted() - Estimated Time Remaining: {} seconds  jobId: {}",
            timeRemaining, initiateJobResult.getJobId());

    DescribeJobRequest djr = new DescribeJobRequest(getVaultName(), initiateJobResult.getJobId());

    DescribeJobResult describeJobResult = client.describeJob(djr);

    _log.debug("archiveRetrievalJobCompleted() - DescribeJobResult: {}", describeJobResult.toString());
    _log.debug("archiveRetrievalJobCompleted() - DescribeJobResult.isCompleted(): {}",
            describeJobResult.isCompleted());
    _log.debug("archiveRetrievalJobCompleted() - DescribeJobResult.status(): {}",
            describeJobResult.getStatusCode());

    _log.debug("archiveRetrievalJobCompleted() - END ");

    return describeJobResult.isCompleted();

}