Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add executorService API to ManagedIdentityCredentialBuilder #43703

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sdk/identity/azure-identity/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ForkJoinPool;

/**
* <p>The base class for credential builders that allow specifying a client ID, tenant ID, authority host, and
Expand Down Expand Up @@ -73,9 +72,9 @@ public T tenantId(String tenantId) {
* Developer is responsible for maintaining the lifecycle of the ExecutorService.
*
* <p>
* 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.
* </p>
*
* <p> The executor service and can be safely shutdown if the TokenCredential is no longer being used by the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}.
Expand Down Expand Up @@ -71,9 +70,9 @@ public AzureApplicationCredentialBuilder managedIdentityResourceId(String resour
* Developer is responsible for maintaining the lifecycle of the ExecutorService.
*
* <p>
* 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.
* </p>
*
* <p> The executor service and can be safely shutdown if the TokenCredential is no longer being used by the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import java.util.List;
import java.util.Objects;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ForkJoinPool;

/**
* <p>Fluent credential builder for instantiating {@link DefaultAzureCredential}.</p>
Expand Down Expand Up @@ -170,9 +169,9 @@ public DefaultAzureCredentialBuilder managedIdentityResourceId(String resourceId
* Developer is responsible for maintaining the lifecycle of the ExecutorService.
*
* <p>
* 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.
* </p>
*
* <p> The executor service and can be safely shutdown if the TokenCredential is no longer being used by the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}.
Expand Down Expand Up @@ -60,9 +59,9 @@ public EnvironmentCredentialBuilder authorityHost(String authorityHost) {
* Developer is responsible for maintaining the lifecycle of the ExecutorService.
*
* <p>
* 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.
* </p>
*
* <p> The executor service and can be safely shutdown if the TokenCredential is no longer being used by the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import com.azure.core.util.logging.ClientLogger;
import com.azure.identity.implementation.util.ValidationUtil;

import java.util.concurrent.ExecutorService;

/**
* <p>Fluent credential builder for instantiating a {@link ManagedIdentityCredential}.</p>
*
Expand Down Expand Up @@ -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.
*
* <p>
* 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.
* </p>
*
* <p> 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. </p>
*
* @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.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

/**
Expand Down Expand Up @@ -214,9 +213,9 @@ public IdentityClientOptions setHttpPipeline(HttpPipeline httpPipeline) {
* Developer is responsible for maintaining the lifecycle of the ExecutorService.
*
* <p>
* 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.
* </p>
*
* <p> The executor service and can be safely shutdown if the TokenCredential is no longer being used by the
Expand Down
Loading