bruno-roustant commented on code in PR #13436:
URL: https://github.com/apache/lucene/pull/13436#discussion_r1619393930


##########
lucene/core/src/java/org/apache/lucene/index/SegmentDocValues.java:
##########
@@ -76,10 +76,12 @@ synchronized DocValuesProducer getDocValuesProducer(
 
   /** Decrement the reference count of the given {@link DocValuesProducer} 
generations. */
   synchronized void decRef(LongArrayList dvProducersGens) throws IOException {
-    for (LongCursor gen : dvProducersGens) {
-      RefCount<DocValuesProducer> dvp = genDVProducers.get(gen.value);
-      assert dvp != null : "gen=" + gen;
-      dvp.decRef();
-    }
+    IOUtils.applyToAll(
+        dvProducersGens.stream().mapToObj(Long::valueOf).toList(),
+        gen -> {
+          RefCount<DocValuesProducer> dvp = genDVProducers.get(gen);
+          assert dvp != null : "gen=" + gen;
+          dvp.decRef();
+        });

Review Comment:
   Yes, good catch. This fix is required to continue using IOUtils.
   I don't know why I didn't read enough the method javadoc.



-- 
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...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to