rdblue commented on code in PR #6837:
URL: https://github.com/apache/iceberg/pull/6837#discussion_r1128412247


##########
core/src/main/java/org/apache/iceberg/rest/RESTSessionCatalog.java:
##########
@@ -168,23 +168,31 @@ public void initialize(String name, Map<String, String> 
unresolved) {
     Map<String, String> baseHeaders = configHeaders(mergedProps);
 
     this.sessions = newSessionCache(mergedProps);
-    this.refreshAuthByDefault =
+    this.keepTokenRefreshed =
         PropertyUtil.propertyAsBoolean(
             mergedProps,
-            CatalogProperties.AUTH_DEFAULT_REFRESH_ENABLED,
-            CatalogProperties.AUTH_DEFAULT_REFRESH_ENABLED_DEFAULT);
+            OAuth2Properties.TOKEN_REFRESH_ENABLED,
+            OAuth2Properties.TOKEN_REFRESH_ENABLED_DEFAULT);
     this.client = clientBuilder.apply(mergedProps);
     this.paths = ResourcePaths.forCatalogProperties(mergedProps);
 
     this.catalogAuth = new AuthSession(baseHeaders, null, null, credential, 
scope);
     if (authResponse != null) {
       this.catalogAuth =
           AuthSession.fromTokenResponse(
-              client, tokenRefreshExecutor(), authResponse, startTimeMillis, 
catalogAuth);
+              client,
+              keepTokenRefreshed ? tokenRefreshExecutor() : null,

Review Comment:
   Does the other branch of a ternary operator get called? If so, this would 
start the thread even if it isn't used.
   
   Seems like the behavior would be more obvious if we embedded this in 
`tokenRefreshExecutor()` so that if `keepTokenRefreshed` is false, it never 
starts a thread and returns `null` itself.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to