danielcweeks commented on code in PR #16848:
URL: https://github.com/apache/iceberg/pull/16848#discussion_r4495245120


##########
gcp/src/main/java/org/apache/iceberg/gcp/auth/GoogleAuthManager.java:
##########
@@ -77,12 +77,30 @@ public String name() {
   }
 
   private void initialize(Map<String, String> properties) {
-    if (initialized) {
+    if (credentials != null) {
       return;
     }
 
-    String credentialsPath = properties.get(GCP_CREDENTIALS_PATH_PROPERTY);
-    String credentialsJson = properties.get(GCP_CREDENTIALS_JSON_PROPERTY);
+    synchronized (this) {
+      if (credentials != null) {
+        return;
+      }
+
+      String credentialsPath = properties.get(GCP_CREDENTIALS_PATH_PROPERTY);
+      String credentialsJson = properties.get(GCP_CREDENTIALS_JSON_PROPERTY);
+      String scopesString = properties.getOrDefault(GCP_SCOPES_PROPERTY, 
DEFAULT_SCOPES);
+
+      try {
+        this.credentials = loadCredentials(credentialsPath, credentialsJson, 
scopesString);
+      } catch (IOException e) {
+        // credentials remains null here and treated as not-initialized. 
Retries are expected

Review Comment:
   These commentary comments are not recommended. This doesn't add value, 
please remove.



-- 
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