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

[FEATURE REQ] Warn if multiple http client providers are on classpath. #18087

Closed
kasobol-msft opened this issue Dec 11, 2020 · 0 comments · Fixed by #23888
Closed

[FEATURE REQ] Warn if multiple http client providers are on classpath. #18087

kasobol-msft opened this issue Dec 11, 2020 · 0 comments · Fixed by #23888
Labels
Azure.Core azure-core

Comments

@kasobol-msft
Copy link
Contributor

Is your feature request related to a problem? Please describe.
When multiple http providers are on classpath it's unclear which is being picked up.
I.e. this code picks first one

private static HttpClientProvider defaultProvider;
private static final String CANNOT_FIND_HTTP_CLIENT = "A request was made to load the default HttpClient provider "
+ "but one could not be found on the classpath. If you are using a dependency manager, consider including a "
+ "dependency on azure-core-http-netty or azure-core-http-okhttp. Depending on your existing dependencies, you "
+ "have the choice of Netty or OkHttp implementations. Additionally, refer to "
+ "https://aka.ms/azsdk/java/docs/custom-httpclient to learn about writing your own implementation.";
static {
ServiceLoader<HttpClientProvider> serviceLoader = ServiceLoader.load(HttpClientProvider.class);
// Use the first provider found in the service loader iterator.
Iterator<HttpClientProvider> it = serviceLoader.iterator();
if (it.hasNext()) {
defaultProvider = it.next();
}
}

Describe the solution you'd like
The HttpClientProviders should either throw runtime exception (and fail fast) or at least log warnings enumerating providers being on classpatch and printing one that has been chosen.
Maybe we should consider some priority list to decide which is picked if multiple are present to make it more predictable.

Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

  • [ x] Description Added
  • [x ] Expected solution specified
@kasobol-msft kasobol-msft added the Azure.Core azure-core label Dec 11, 2020
azure-sdk pushed a commit to azure-sdk/azure-sdk-for-java that referenced this issue Apr 9, 2022
[Hub Generated] Review request for Microsoft.DocumentDB to add version preview/2022-02-15-preview (Azure#18087)

* Adds base for updating Microsoft.DocumentDB from version preview/2021-11-15-preview to version 2022-02-15-preview

* Updates readme

* Updates API version in new specs and examples

* Partition Merge RP API changes

* fix spec to reflect the returned value

* fix serialization of merge response

* Add mongodb API

* prettier fix

* fixed Linter and Prettier errors

* prettier fixes

* fix linter errors

* address CR feedback

* semantic validation fixes

* fix mongodb merge example

* support for pitr basic/lite

* fix pretty and add mongo 4.2

* Adding Support for Client Encryption Policy in swagger spec

* Update cosmos-db.json

* Update cosmos-db.json

* Update CosmosDBSqlContainerCreateUpdate.json

* Fixed prettier checl

* Fixed prettier check

Co-authored-by: Vinh Trinh <[email protected]>
Co-authored-by: Santosh Kulkarni <[email protected]>
@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Azure.Core azure-core
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant