nastra commented on code in PR #7046:
URL: https://github.com/apache/iceberg/pull/7046#discussion_r1132023740


##########
aws/src/main/java/org/apache/iceberg/aws/s3/signer/S3V4RestSignerClient.java:
##########
@@ -113,6 +113,20 @@ boolean keepTokenRefreshed() {
         OAuth2Properties.TOKEN_REFRESH_ENABLED_DEFAULT);
   }
 
+  @Nullable
+  private ScheduledExecutorService tokenRefreshExecutor() {
+    if (!keepTokenRefreshed()) {
+      return null;
+    }
+
+    if (null == TOKEN_REFRESH_EXECUTOR.get()) {
+      TOKEN_REFRESH_EXECUTOR.compareAndSet(

Review Comment:
   this is the main advantage of having an `AtomicReference`: we don't need 
`synchronized` here because `TOKEN_REFRESH_EXECUTOR` will only be atomically 
set to the given updated value if the current value is `null`. 
   If another thread happened to set `TOKEN_REFRESH_EXECUTOR` first, then we 
don't do anything here.



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

Reply via email to