blambov commented on code in PR #2064:
URL: https://github.com/apache/cassandra/pull/2064#discussion_r1081320529


##########
src/java/org/apache/cassandra/io/sstable/format/SSTableReader.java:
##########
@@ -1973,17 +1970,36 @@ public void run()
                     if (logger.isTraceEnabled())
                         logger.trace("Async instance tidier for {}, after 
barrier", descriptor);
 
-                    if (bf != null)
-                        bf.close();
-                    if (summary != null)
-                        summary.close();
-                    if (runOnClose != null)
+                    Throwable exceptions = null;
+                    if (runOnClose != null) try
+                    {
                         runOnClose.run();
-                    if (dfile != null)
-                        dfile.close();
-                    if (ifile != null)
-                        ifile.close();
-                    globalRef.release();
+                    }
+                    catch (RuntimeException | Error ex)
+                    {
+                        logger.error("Failed to run on-close listeners for 
sstable " + descriptor.baseFilename(), ex);
+                        exceptions = ex;
+                    }
+
+                    Throwable closeExceptions = Throwables.close(null, 
closeables);

Review Comment:
   It's practically the same pattern, since you do have a check for this 
concrete part throwing exceptions.
   
   The reason for asking is to avoid relaxing `Throwables.close` -- we may lose 
an error message we care about for something that should not be null.
   
   Alternatively, we can add a `closeIgnoringNulls` method to `Throwables`.



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