thecoop commented on code in PR #16883:
URL: https://github.com/apache/lucene/pull/16883#discussion_r4350105858


##########
lucene/core/src/java/org/apache/lucene/codecs/lucene90/Lucene90CompoundReader.java:
##########
@@ -148,13 +150,17 @@ private Map<String, FileEntry> readMapping(IndexInput 
entriesStream) throws IOEx
 
   @Override
   public void close() throws IOException {
-    IndexInput merge;
+    List<IndexInput> others = new ArrayList<>();
     synchronized (this) {
       closed = true;
-      merge = mergeHandle == handle ? null : mergeHandle;
-      mergeHandle = null;
+      for (Mapping mapping : mappings) {
+        if (mapping.data != handle) {
+          others.add(mapping.data);
+        }
+      }
+      mappings.clear();
     }
-    IOUtils.close(handle, merge);
+    IOUtils.close(handle, () -> IOUtils.close(others));

Review Comment:
   Rather than nested `close`, why not just start off with `handle` in 
`others`, and just close the list items?



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