milleruntime commented on code in PR #2811:
URL: https://github.com/apache/accumulo/pull/2811#discussion_r937016343
##########
server/tserver/src/main/java/org/apache/accumulo/tserver/TabletClientHandler.java:
##########
@@ -1202,33 +1202,25 @@ public void flush(TInfo tinfo, TCredentials
credentials, String lock, String tab
throw new RuntimeException(e);
}
- ArrayList<Tablet> tabletsToFlush = new ArrayList<>();
-
KeyExtent ke = new KeyExtent(TableId.of(tableId),
ByteBufferUtil.toText(endRow),
ByteBufferUtil.toText(startRow));
- for (Tablet tablet : server.getOnlineTablets().values()) {
- if (ke.overlaps(tablet.getExtent())) {
- tabletsToFlush.add(tablet);
- }
- }
-
- Long flushID = null;
+ final Long[] flushID = {null};
Review Comment:
I think this workaround to make the object final could give you a
ConcurrentModificationException or some type of concurrency problems. They made
it a compile time error for a reason, this answer here gives a good explanation
https://stackoverflow.com/questions/34865383/variable-used-in-lambda-expression-should-be-final-or-effectively-final
I am not sure how the equivalent logic could be accomplished with a stream.
It may be better to use a traditional for loop.
--
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]