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


##########
core/src/main/java/org/apache/iceberg/rest/RESTSessionCatalog.java:
##########
@@ -873,4 +901,20 @@ private static Cache<String, AuthSession> 
newSessionCache(Map<String, String> pr
             (RemovalListener<String, AuthSession>) (id, auth, cause) -> 
auth.stopRefreshing())
         .build();
   }
+
+  private Cache<TableOperations, FileIO> newFileIOCloser() {
+    return Caffeine.newBuilder()
+        .scheduler(
+            Scheduler.forScheduledExecutorService(
+                ThreadPools.newScheduledPool(name() + "-fileio-closer", 1)))
+        .weakKeys()
+        .removalListener(
+            (RemovalListener<TableOperations, FileIO>)
+                (ops, fileIO, cause) -> {
+                  if (null != fileIO) {

Review Comment:
   the API contract of the `RemovalListener` marks keys/values as being 
`@Nullable`: `void onRemoval(@Nullable K key, @Nullable V value, @NonNull 
RemovalCause cause);`
   
   Since we're not using `weakValues()` here the value shouldn't be null as 
indicated by the Javadoc, so this is rather to be defensive and avoid warnings 
in IntelliJ (we have the same warning a few lines above in the session cache 
btw)



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