Skip to content

Commit f586ce7

Browse files
committed
a neater way to deal with multi-confirms
1 parent 5723bc1 commit f586ce7

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

test/src/com/rabbitmq/examples/MulticastMain.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -290,12 +290,9 @@ public synchronized void handleBasicReturn(int replyCode,
290290
public void handleAck(long seqNo, boolean multiple) {
291291
int numConfirms = 0;
292292
if (multiple) {
293-
for (long i = ackSet.first(); i <= seqNo; ++i) {
294-
if (!ackSet.contains(i))
295-
continue;
296-
ackSet.remove(i);
297-
numConfirms++;
298-
}
293+
SortedSet<Long> confirmed = ackSet.headSet(seqNo + 1);
294+
numConfirms += confirmed.size();
295+
confirmed.clear();
299296
} else {
300297
ackSet.remove(seqNo);
301298
numConfirms = 1;

0 commit comments

Comments
 (0)