use of com.microsoft.azure.storage.blob.BlobRequestOptions in project camel by apache.
the class BlobServiceUtil method getRequestOptions.
public static BlobServiceRequestOptions getRequestOptions(Exchange exchange) {
BlobServiceRequestOptions opts = exchange.getIn().getHeader(BlobServiceConstants.BLOB_SERVICE_REQUEST_OPTIONS, BlobServiceRequestOptions.class);
if (opts != null) {
return opts;
} else {
opts = new BlobServiceRequestOptions();
}
AccessCondition accessCond = exchange.getIn().getHeader(BlobServiceConstants.ACCESS_CONDITION, AccessCondition.class);
BlobRequestOptions requestOpts = exchange.getIn().getHeader(BlobServiceConstants.BLOB_REQUEST_OPTIONS, BlobRequestOptions.class);
OperationContext opContext = exchange.getIn().getHeader(BlobServiceConstants.OPERATION_CONTEXT, OperationContext.class);
opts.setAccessCond(accessCond);
opts.setOpContext(opContext);
opts.setRequestOpts(requestOpts);
return opts;
}
use of com.microsoft.azure.storage.blob.BlobRequestOptions in project hadoop by apache.
the class BlockBlobAppendStream method commitAppendBlocks.
/**
* Method to commit all the uncommited blocks to azure storage.
* If the commit fails then blocks are automatically cleaned up
* by Azure storage.
* @throws IOException
*/
private synchronized void commitAppendBlocks() throws IOException {
SelfRenewingLease lease = null;
try {
if (uncommittedBlockEntries.size() > 0) {
//Acquiring lease on the blob.
lease = new SelfRenewingLease(blob);
// Downloading existing blocks
List<BlockEntry> blockEntries = blob.downloadBlockList(BlockListingFilter.COMMITTED, new BlobRequestOptions(), opContext);
// Adding uncommitted blocks.
blockEntries.addAll(uncommittedBlockEntries);
AccessCondition accessCondition = new AccessCondition();
accessCondition.setLeaseID(lease.getLeaseID());
blob.commitBlockList(blockEntries, accessCondition, new BlobRequestOptions(), opContext);
uncommittedBlockEntries.clear();
}
} catch (StorageException ex) {
LOG.error("Storage exception encountered during block commit phase of append for blob" + " : {} Storage Exception : {} Error Code: {}", key, ex, ex.getErrorCode());
throw new IOException("Encountered Exception while committing append blocks", ex);
} finally {
if (lease != null) {
try {
lease.free();
} catch (StorageException ex) {
LOG.debug("Exception encountered while releasing lease for " + "blob : {} StorageException : {} ErrorCode : {}", key, ex, ex.getErrorCode());
// Swallowing exception here as the lease is cleaned up by the SelfRenewingLease object.
}
}
}
}
use of com.microsoft.azure.storage.blob.BlobRequestOptions in project hadoop by apache.
the class AzureNativeFileSystemStore method getUploadOptions.
private BlobRequestOptions getUploadOptions() {
BlobRequestOptions options = new BlobRequestOptions();
options.setStoreBlobContentMD5(sessionConfiguration.getBoolean(KEY_STORE_BLOB_MD5, false));
options.setUseTransactionalContentMD5(getUseTransactionalContentMD5());
options.setConcurrentRequestCount(concurrentWrites);
options.setRetryPolicyFactory(new RetryExponentialRetry(minBackoff, deltaBackoff, maxBackoff, maxRetries));
return options;
}
use of com.microsoft.azure.storage.blob.BlobRequestOptions in project hadoop by apache.
the class PageBlobFormatHelpers method withMD5Checking.
public static BlobRequestOptions withMD5Checking() {
BlobRequestOptions options = new BlobRequestOptions();
options.setUseTransactionalContentMD5(true);
return options;
}
Aggregations