Skip to content

Commit

Permalink
refine buildBlobSyncClient
Browse files Browse the repository at this point in the history
  • Loading branch information
snalli committed Aug 2, 2023
1 parent e8335cf commit ecec329
Showing 1 changed file with 5 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -411,20 +411,12 @@ protected BlobServiceAsyncClient createBlobStorageAsyncClient() {
}

protected BlobServiceClient createBlobStorageSyncClient() {
validateABSAuthConfigs(azureCloudConfig);
Configuration storageConfiguration = new Configuration();
// Check for network proxy
ProxyOptions proxyOptions = (cloudConfig.vcrProxyHost == null) ? null : new ProxyOptions(ProxyOptions.Type.HTTP,
new InetSocketAddress(cloudConfig.vcrProxyHost, cloudConfig.vcrProxyPort));
if (proxyOptions != null) {
logger.info("Using proxy: {}:{}", cloudConfig.vcrProxyHost, cloudConfig.vcrProxyPort);
}
HttpClient client = new NettyAsyncHttpClientBuilder().proxy(proxyOptions).build();

// Note: retry decisions are made at CloudBlobStore level. Configure storageClient with no retries.
RequestRetryOptions noRetries = new RequestRetryOptions(RetryPolicyType.FIXED, 1, (Integer) null, null, null, null);
try {
return buildBlobServiceSyncClient(client, storageConfiguration, noRetries, azureCloudConfig);
validateABSAuthConfigs(azureCloudConfig);
ProxyOptions proxyOptions = new ProxyOptions(ProxyOptions.Type.HTTP,
new InetSocketAddress(cloudConfig.vcrProxyHost, cloudConfig.vcrProxyPort));
HttpClient client = new NettyAsyncHttpClientBuilder().proxy(proxyOptions).build();
return buildBlobServiceSyncClient(client, new Configuration(), new RequestRetryOptions(), azureCloudConfig);
} catch (MalformedURLException | InterruptedException | ExecutionException ex) {
logger.error("Error building ABS blob service client: {}", ex.getMessage());
throw new IllegalStateException(ex);
Expand Down

0 comments on commit ecec329

Please sign in to comment.