DomGarguilo commented on code in PR #3980:
URL: https://github.com/apache/accumulo/pull/3980#discussion_r1408276253


##########
core/src/main/java/org/apache/accumulo/core/clientImpl/bulk/ConcurrentKeyExtentCache.java:
##########
@@ -88,9 +88,10 @@ protected void updateCache(KeyExtent e) {
 
   @VisibleForTesting
   protected Stream<KeyExtent> lookupExtents(Text row) {
-    return TabletsMetadata.builder(ctx).forTable(tableId).overlapping(row, 
true, null)
-        .checkConsistency().fetch(PREV_ROW).build().stream().limit(100)
-        .map(TabletMetadata::getExtent);
+    try (TabletsMetadata tabletsMetadata = 
TabletsMetadata.builder(ctx).forTable(tableId)
+        .overlapping(row, true, 
null).checkConsistency().fetch(PREV_ROW).build()) {
+      return 
tabletsMetadata.stream().limit(100).map(TabletMetadata::getExtent);

Review Comment:
   I think returning an Iterator might be okay since we can add a step to make 
sure the iterator is created from a collection created from the resource rather 
than directly off of the resource but it seems more hacky to do that with a 
stream, i.e. converting from a stream to a collection then back to a stream in 
order to de-couple from the underlying resource. 



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

Reply via email to