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] Expensive DefaultCredentialsProvider instantiated always even if not needed #392

Open
YotillaAntoni opened this issue Dec 20, 2024 · 0 comments

Comments

@YotillaAntoni
Copy link

YotillaAntoni commented Dec 20, 2024

Problem Statement
The bootstrap of the API is unnecessarily slow due to the instantiation in DatabricksConfig of the DefaultCredentialsProvider in line 18:

private CredentialsProvider credentialsProvider = new DefaultCredentialsProvider();

The DefaultCredentialsProvider instantiates all 11 available CredentialsProvider implementation triggering a lot of class loading and objects instantiation.

The DatabricksConfig object has a setter for the CredentialsProvider, so user of the API can choose and set his/her provider, but even if that case the DefaultCredentialsProvider will be instantiated as part of the field initialization.

Proposed Solution
Only create an instance of DefaultCredentialsProvider inside the authenticate method if the credentalasProvider field has not been set.

Alternatively, inside the DefaultCredentailsProvider, the different providerClasses could be instantiated lazily instead of inside the constructor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant