adutra commented on code in PR #14178: URL: https://github.com/apache/iceberg/pull/14178#discussion_r2399166204
########## core/src/main/java/org/apache/iceberg/rest/auth/OAuth2Manager.java: ########## @@ -259,16 +260,41 @@ protected OAuth2Util.AuthSession newSessionFromTokenExchange( protected OAuth2Util.AuthSession newSessionFromTokenResponse( AuthConfig config, OAuth2Util.AuthSession parent) { + RESTClient client = refreshClient; OAuthTokenResponse response = OAuth2Util.fetchToken( - refreshClient, + client, Map.of(), config.credential(), config.scope(), config.oauth2ServerUri(), config.optionalOAuthParams()); return OAuth2Util.AuthSession.fromTokenResponse( - refreshClient, refreshExecutor(), response, System.currentTimeMillis(), parent); + client, refreshExecutor(), response, System.currentTimeMillis(), parent); + } + + private void maybeInitRefreshClient(RESTClient sharedClient, AuthSession session) { + if (refreshClient == null) { + synchronized (this) { + if (refreshClient == null) { + refreshClient = sharedClient.withAuthSession(session); + } + } + } + } + + private AuthSessionCache getOrCreateSessionCache(Map<String, String> properties) { + AuthSessionCache cache = this.sessionCache; Review Comment: I did some simplification, PTAL again. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org