ctubbsii commented on code in PR #2636:
URL: https://github.com/apache/accumulo/pull/2636#discussion_r852259145
##########
core/src/main/java/org/apache/accumulo/core/client/ScannerBase.java:
##########
@@ -370,4 +372,15 @@ default void forEach(BiConsumer<? super Key,? super Value>
keyValueConsumer) {
keyValueConsumer.accept(entry.getKey(), entry.getValue());
}
}
+
+ /**
+ * Stream the Scanner results sequentially from this scanner's iterator
+ *
Review Comment:
I don't think that's necessary. We shouldn't specifically require the use of
a try-with-resources block to close the Scanner. That's an optional language
construct. The same goes for using `.onClose(scanner::close)`. It's a good idea
for the user to close the Scanner object when they are done with it, but we
shouldn't be prescriptive about how they manage their resource. They can close
it whenever they like. They may want to re-use the Scanner for another stream.
We don't offer recommendations for closing Scanner when iterator() or
forEach() is used. I don't see why this would be different. It should suffice
that Scanner is Closeable, and therefore expected to be closed when they are
finished using it.
--
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]