diff --git a/sdk/identity/azure-identity/CHANGELOG.md b/sdk/identity/azure-identity/CHANGELOG.md index c7c371e0dfd17..a6c0ffbdb4298 100644 --- a/sdk/identity/azure-identity/CHANGELOG.md +++ b/sdk/identity/azure-identity/CHANGELOG.md @@ -3,6 +3,7 @@ ## 1.15.0-beta.1 (Unreleased) ### Features Added +- Added missing `executorService` API to `ManagedIdentityCredentialBuilder`, cleaned up comments in other types for this method. ### Breaking Changes diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/AadCredentialBuilderBase.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/AadCredentialBuilderBase.java index 42fb6f197f8f9..35a7d39da0fd4 100644 --- a/sdk/identity/azure-identity/src/main/java/com/azure/identity/AadCredentialBuilderBase.java +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/AadCredentialBuilderBase.java @@ -10,7 +10,6 @@ import java.util.Arrays; import java.util.List; import java.util.concurrent.ExecutorService; -import java.util.concurrent.ForkJoinPool; /** *
The base class for credential builders that allow specifying a client ID, tenant ID, authority host, and @@ -73,9 +72,9 @@ public T tenantId(String tenantId) { * Developer is responsible for maintaining the lifecycle of the ExecutorService. * *
- * If this is not configured, the {@link ForkJoinPool#commonPool() common fork join pool} will be used which is - * also shared with other application tasks. If the common pool is heavily used for other tasks, authentication - * requests might starve and setting up this executor service should be considered. + * If this is not configured, the {@link com.azure.core.util.SharedExecutorService} will be used which is + * also shared with other SDK libraries. If there are many concurrent SDK tasks occurring, authentication + * requests might starve and configuring a separate executor service should be considered. *
* *The executor service and can be safely shutdown if the TokenCredential is no longer being used by the diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/AzureApplicationCredentialBuilder.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/AzureApplicationCredentialBuilder.java index ca50438887ba4..7141e75a1018c 100644 --- a/sdk/identity/azure-identity/src/main/java/com/azure/identity/AzureApplicationCredentialBuilder.java +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/AzureApplicationCredentialBuilder.java @@ -9,7 +9,6 @@ import java.util.ArrayList; import java.util.concurrent.ExecutorService; -import java.util.concurrent.ForkJoinPool; /** * Fluent credential builder for instantiating a {@link AzureApplicationCredential}. @@ -71,9 +70,9 @@ public AzureApplicationCredentialBuilder managedIdentityResourceId(String resour * Developer is responsible for maintaining the lifecycle of the ExecutorService. * *
- * If this is not configured, the {@link ForkJoinPool#commonPool()} will be used which is - * also shared with other application tasks. If the common pool is heavily used for other tasks, authentication - * requests might starve and setting up this executor service should be considered. + * If this is not configured, the {@link com.azure.core.util.SharedExecutorService} will be used which is + * also shared with other SDK libraries. If there are many concurrent SDK tasks occurring, authentication + * requests might starve and configuring a separate executor service should be considered. *
* *The executor service and can be safely shutdown if the TokenCredential is no longer being used by the diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/DefaultAzureCredentialBuilder.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/DefaultAzureCredentialBuilder.java index 342686c1d052f..bd98f52968f42 100644 --- a/sdk/identity/azure-identity/src/main/java/com/azure/identity/DefaultAzureCredentialBuilder.java +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/DefaultAzureCredentialBuilder.java @@ -17,7 +17,6 @@ import java.util.List; import java.util.Objects; import java.util.concurrent.ExecutorService; -import java.util.concurrent.ForkJoinPool; /** *
Fluent credential builder for instantiating {@link DefaultAzureCredential}.
@@ -170,9 +169,9 @@ public DefaultAzureCredentialBuilder managedIdentityResourceId(String resourceId * Developer is responsible for maintaining the lifecycle of the ExecutorService. * *- * If this is not configured, the {@link ForkJoinPool#commonPool() common fork join pool} will be used which is - * also shared with other application tasks. If the common pool is heavily used for other tasks, authentication - * requests might starve and setting up this executor service should be considered. + * If this is not configured, the {@link com.azure.core.util.SharedExecutorService} will be used which is + * also shared with other SDK libraries. If there are many concurrent SDK tasks occurring, authentication + * requests might starve and configuring a separate executor service should be considered. *
* *The executor service and can be safely shutdown if the TokenCredential is no longer being used by the diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/EnvironmentCredentialBuilder.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/EnvironmentCredentialBuilder.java index 1b855c905e74d..cd922d0dbf79b 100644 --- a/sdk/identity/azure-identity/src/main/java/com/azure/identity/EnvironmentCredentialBuilder.java +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/EnvironmentCredentialBuilder.java @@ -8,7 +8,6 @@ import com.azure.identity.implementation.util.ValidationUtil; import java.util.concurrent.ExecutorService; -import java.util.concurrent.ForkJoinPool; /** * Fluent credential builder for instantiating a {@link EnvironmentCredential}. @@ -60,9 +59,9 @@ public EnvironmentCredentialBuilder authorityHost(String authorityHost) { * Developer is responsible for maintaining the lifecycle of the ExecutorService. * *
- * If this is not configured, the {@link ForkJoinPool#commonPool()} will be used which is - * also shared with other application tasks. If the common pool is heavily used for other tasks, authentication - * requests might starve and setting up this executor service should be considered. + * If this is not configured, the {@link com.azure.core.util.SharedExecutorService} will be used which is + * also shared with other SDK libraries. If there are many concurrent SDK tasks occurring, authentication + * requests might starve and configuring a separate executor service should be considered. *
* *The executor service and can be safely shutdown if the TokenCredential is no longer being used by the diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/ManagedIdentityCredentialBuilder.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/ManagedIdentityCredentialBuilder.java index 919b860bbfeee..a55cafdba5b4c 100644 --- a/sdk/identity/azure-identity/src/main/java/com/azure/identity/ManagedIdentityCredentialBuilder.java +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/ManagedIdentityCredentialBuilder.java @@ -6,6 +6,8 @@ import com.azure.core.util.logging.ClientLogger; import com.azure.identity.implementation.util.ValidationUtil; +import java.util.concurrent.ExecutorService; + /** *
Fluent credential builder for instantiating a {@link ManagedIdentityCredential}.
* @@ -106,6 +108,27 @@ public ManagedIdentityCredentialBuilder objectId(String objectId) { return this; } + /** + * Specifies the ExecutorService to be used to execute the authentication requests. + * Developer is responsible for maintaining the lifecycle of the ExecutorService. + * + *+ * If this is not configured, the {@link com.azure.core.util.SharedExecutorService} will be used which is + * also shared with other SDK libraries. If there are many concurrent SDK tasks occurring, authentication + * requests might starve and configuring a separate executor service should be considered. + *
+ * + *The executor service and can be safely shutdown if the TokenCredential is no longer being used by the + * Azure SDK clients and should be shutdown before the application exits.
+ * + * @param executorService the executor service to use for executing authentication requests. + * @return the ManagedIdentityCredentialBuilder itself + */ + public ManagedIdentityCredentialBuilder executorService(ExecutorService executorService) { + this.identityClientOptions.setExecutorService(executorService); + return this; + } + /** * Creates a new {@link ManagedIdentityCredential} with the current configurations. * diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/IdentityClientOptions.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/IdentityClientOptions.java index af471c14dd94d..f6e2ea22a637f 100644 --- a/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/IdentityClientOptions.java +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/IdentityClientOptions.java @@ -13,8 +13,8 @@ import com.azure.core.util.ClientOptions; import com.azure.core.util.Configuration; import com.azure.core.util.logging.ClientLogger; -import com.azure.identity.AzureAuthorityHosts; import com.azure.identity.AuthenticationRecord; +import com.azure.identity.AzureAuthorityHosts; import com.azure.identity.BrowserCustomizationOptions; import com.azure.identity.ChainedTokenCredential; import com.azure.identity.TokenCachePersistenceOptions; @@ -29,7 +29,6 @@ import java.util.Set; import java.util.TreeSet; import java.util.concurrent.ExecutorService; -import java.util.concurrent.ForkJoinPool; import java.util.function.Function; /** @@ -214,9 +213,9 @@ public IdentityClientOptions setHttpPipeline(HttpPipeline httpPipeline) { * Developer is responsible for maintaining the lifecycle of the ExecutorService. * *- * If this is not configured, the {@link ForkJoinPool#commonPool() common fork join pool} will be used which is - * also shared with other application tasks. If the common pool is heavily used for other tasks, authentication - * requests might starve and setting up this executor service should be considered. + * If this is not configured, the {@link com.azure.core.util.SharedExecutorService} will be used which is + * also shared with other SDK libraries. If there are many concurrent SDK tasks occurring, authentication + * requests might starve and configuring a separate executor service should be considered. *
* *The executor service and can be safely shutdown if the TokenCredential is no longer being used by the