Search in sources :

Example 1 with RetryPolicyFactory

use of com.microsoft.azure.storage.RetryPolicyFactory in project kylo by Teradata.

the class AzureNativeFileSystemProvider method createBlobClient.

@Nonnull
private CloudBlobClient createBlobClient(@Nonnull final URI uri, @Nonnull final Configuration conf) {
    // Determine endpoint
    final String httpScheme = StringUtils.equalsAnyIgnoreCase(uri.getScheme(), "asvs", "wasbs") ? "https" : "http";
    final URI blobEndPoint = URI.create(httpScheme + "://" + uri.getRawAuthority());
    // Create client
    final CloudBlobClient client = new CloudBlobClient(blobEndPoint, getCredentials(uri, conf));
    final RetryPolicyFactory retryPolicyFactory = new RetryExponentialRetry(conf.getInt("fs.azure.io.retry.min.backoff.interval", 3 * 1000), conf.getInt("fs.azure.io.retry.backoff.interval", 3 * 1000), conf.getInt("fs.azure.io.retry.max.backoff.interval", 30 * 1000), conf.getInt("fs.azure.io.retry.max.retries", 30));
    client.getDefaultRequestOptions().setRetryPolicyFactory(retryPolicyFactory);
    final int storageConnectionTimeout = conf.getInt("fs.azure.storage.timeout", 0);
    if (storageConnectionTimeout > 0) {
        client.getDefaultRequestOptions().setTimeoutIntervalInMs(storageConnectionTimeout * 1000);
    }
    return client;
}
Also used : CloudBlobClient(com.microsoft.azure.storage.blob.CloudBlobClient) URI(java.net.URI) RetryPolicyFactory(com.microsoft.azure.storage.RetryPolicyFactory) RetryExponentialRetry(com.microsoft.azure.storage.RetryExponentialRetry) Nonnull(javax.annotation.Nonnull)

Aggregations

RetryExponentialRetry (com.microsoft.azure.storage.RetryExponentialRetry)1 RetryPolicyFactory (com.microsoft.azure.storage.RetryPolicyFactory)1 CloudBlobClient (com.microsoft.azure.storage.blob.CloudBlobClient)1 URI (java.net.URI)1 Nonnull (javax.annotation.Nonnull)1