Skip to content

[#7706] improvement: Reuse token in OAuth2TokenProvider’s getTokenData method instead of calling getAccessToken twice#7709

Merged
justinmclean merged 2 commits intoapache:mainfrom
arjun7579:main
Jul 16, 2025
Merged

[#7706] improvement: Reuse token in OAuth2TokenProvider’s getTokenData method instead of calling getAccessToken twice#7709
justinmclean merged 2 commits intoapache:mainfrom
arjun7579:main

Conversation

@arjun7579
Copy link
Copy Markdown
Contributor

@arjun7579 arjun7579 commented Jul 15, 2025

What changes were proposed in this pull request?

Instead of calling the getAccessToken() function twice, we store the returned value in a variable and reuse it within the method.

Why are the changes needed?

The previous approach was inefficient because it invoked the same function twice. With this change, the function is called only once, and the result is cached in a local variable, improving performance and avoiding redundant method calls.

Fix: #7706

Copy link
Copy Markdown
Member

@justinmclean justinmclean left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks for looking into this.

@arjun7579
Copy link
Copy Markdown
Contributor Author

Looks good, thanks for looking into this.

always happy to help 😄

@roryqi roryqi changed the title Update OAuth2TokenProvider.java #7706] [Improvement] Reuse token in OAuth2TokenProvider’s getTokenData method instead of calling getAccessToken twice Jul 15, 2025
@roryqi roryqi changed the title #7706] [Improvement] Reuse token in OAuth2TokenProvider’s getTokenData method instead of calling getAccessToken twice [#7706] improvement: Reuse token in OAuth2TokenProvider’s getTokenData method instead of calling getAccessToken twice Jul 15, 2025
Copy link
Copy Markdown
Member

@justinmclean justinmclean left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing that

@justinmclean justinmclean merged commit 4789f4d into apache:main Jul 16, 2025
30 checks passed
roryqi pushed a commit to qqqttt123/gravitino that referenced this pull request Jul 30, 2025
…kenData method instead of calling getAccessToken twice (apache#7709)

### What changes were proposed in this pull request?

Instead of calling the `getAccessToken()` function twice, we store the
returned value in a variable and reuse it within the method.

### Why are the changes needed?

The previous approach was inefficient because it invoked the same
function twice. With this change, the function is called only once, and
the result is cached in a local variable, improving performance and
avoiding redundant method calls.

Fix: apache#7706
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

Successfully merging this pull request may close these issues.

[Improvement] Reuse token in OAuth2TokenProvider’s getTokenData method instead of calling getAccessToken twice

2 participants