Dharshan
Dharshan

Reputation: 404

Blob.getCopyState() returning null

Is this function not implemented in the java sdk? It appears to always return null. I am copy one page blob to another and want to track the status of the copy.

    CloudPageBlob srcBlob = container.getPageBlobReference("source.vhd";
    String newname="dst.vhd";
    CloudPageBlob dstBlob = container.getPageBlobReference(newname);
    dstBlob.startCopyFromBlob(srcBlob);

    //Get the blob again for updated state
    dstBlob = container.getPageBlobReference(newname);
    CopyState state = dstBlob.getCopyState();

Is there any other way to get status? I am using azure-storage-1.2.0.jar

Upvotes: 0

Views: 408

Answers (1)

Adam Sorrin - MSFT
Adam Sorrin - MSFT

Reputation: 576

getPageBlobReference() is purely a local operation, it does not communicate with the Azure Storage service. You need to call dstBlob.downloadAttributes() in between calling getPageBlobReference() and getCopyState(). This will make the service call that will populate the blob's properties, including the copy state.

Upvotes: 3

Related Questions