SzyWilliam commented on code in PR #735:
URL: https://github.com/apache/ratis/pull/735#discussion_r963028795
##########
ratis-server/src/main/java/org/apache/ratis/server/impl/ReadRequests.java:
##########
@@ -129,28 +142,75 @@ synchronized AppendEntriesListener add(long commitIndex,
Function<Long, AppendEn
synchronized void onAppendEntriesReply(AppendEntriesReplyProto reply,
Predicate<Predicate<RaftPeerId>>
hasMajority) {
final long callId = reply.getServerReply().getCallId();
- for (;;) {
- final Map.Entry<Long, AppendEntriesListener> first =
sorted.firstEntry();
- if (first == null || first.getKey() > callId) {
+ for (Map.Entry<Long, AppendEntriesListener> entry : sorted.entrySet()) {
Review Comment:
I'll use Iterator here to avoid `ConcurrentModificationException`.
--
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]