diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/IdentityClientBase.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/IdentityClientBase.java index 0446162a4aebe..55e58d402e0fb 100644 --- a/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/IdentityClientBase.java +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/IdentityClientBase.java @@ -22,6 +22,7 @@ import com.azure.core.util.ClientOptions; import com.azure.core.util.Configuration; import com.azure.core.util.CoreUtils; +import com.azure.core.util.SharedExecutorService; import com.azure.core.util.UserAgentUtil; import com.azure.core.util.builder.ClientBuilderUtil; import com.azure.core.util.logging.ClientLogger; @@ -269,6 +270,8 @@ ConfidentialClientApplication getConfidentialClient(boolean enableCae) { if (options.getExecutorService() != null) { applicationBuilder.executorService(options.getExecutorService()); + } else { + applicationBuilder.executorService(SharedExecutorService.getInstance()); } TokenCachePersistenceOptions tokenCachePersistenceOptions = options.getTokenCacheOptions(); @@ -330,6 +333,8 @@ PublicClientApplication getPublicClient(boolean sharedTokenCacheCredential, bool if (options.getExecutorService() != null) { builder.executorService(options.getExecutorService()); + } else { + builder.executorService(SharedExecutorService.getInstance()); } if (enableCae) { @@ -446,6 +451,8 @@ ConfidentialClientApplication getManagedIdentityConfidentialClient() { if (options.getExecutorService() != null) { applicationBuilder.executorService(options.getExecutorService()); + } else { + applicationBuilder.executorService(SharedExecutorService.getInstance()); } return applicationBuilder.build(); @@ -483,6 +490,8 @@ ManagedIdentityApplication getManagedIdentityMsalApplication() { if (options.getExecutorService() != null) { miBuilder.executorService(options.getExecutorService()); + } else { + miBuilder.executorService(SharedExecutorService.getInstance()); } return miBuilder.build(); @@ -524,6 +533,8 @@ ConfidentialClientApplication getWorkloadIdentityConfidentialClient() { if (options.getExecutorService() != null) { applicationBuilder.executorService(options.getExecutorService()); + } else { + applicationBuilder.executorService(SharedExecutorService.getInstance()); } return applicationBuilder.build(); diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/batching/SearchIndexingPublisher.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/batching/SearchIndexingPublisher.java index 55dab982b93aa..315774615d0e5 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/batching/SearchIndexingPublisher.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/batching/SearchIndexingPublisher.java @@ -152,8 +152,8 @@ public void flush(boolean awaitLock, boolean isClose, Duration timeout, Context private void flushLoop(boolean isClosed, Duration timeout, Context context) { if (timeout != null && !timeout.isNegative() && !timeout.isZero()) { final AtomicReference>> batchActions = new AtomicReference<>(); - Future future - = SharedExecutorService.getInstance().submit(() -> flushLoopHelper(isClosed, context, batchActions)); + Future future = SharedExecutorService.getInstance() + .submit(() -> flushLoopHelper(isClosed, context, batchActions)); try { CoreUtils.getResultWithTimeout(future, timeout); diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableServiceClient.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableServiceClient.java index cb002a9141ec7..6d64e5d9884d2 100644 --- a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableServiceClient.java +++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableServiceClient.java @@ -473,10 +473,8 @@ public Response createTableIfNotExistsWithResponse(String tableName Context context) { Supplier> callable = () -> createTableIfNotExistsWithResponse(tableName, context); Response returnedResponse = callWithOptionalTimeout(callable, timeout, logger, true); - return returnedResponse.getValue() == null - ? new SimpleResponse<>(returnedResponse.getRequest(), returnedResponse.getStatusCode(), - returnedResponse.getHeaders(), getTableClient(tableName)) - : returnedResponse; + return returnedResponse.getValue() == null ? new SimpleResponse<>(returnedResponse.getRequest(), + returnedResponse.getStatusCode(), returnedResponse.getHeaders(), getTableClient(tableName)) : returnedResponse; } Response createTableIfNotExistsWithResponse(String tableName, Context context) {