Skip to content

Commit 18e4933

Browse files
author
Alexandru Scvortov
committed
fix logic in ConfirmDontLoseMessages
1 parent 24d0764 commit 18e4933

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,17 +78,16 @@ public void run() {
7878
public void handleAck(long seqNo,
7979
boolean multiple) {
8080
if (multiple) {
81-
for (long i = ackSet.first(); i <= seqNo; ++i)
82-
ackSet.remove(i);
81+
ackSet.headSet(seqNo+1).clear();
8382
} else {
84-
ackSet.remove(seqNo);
83+
ackSet.remove(seqNo);
8584
}
8685
}
8786
});
8887

8988
// Publish
9089
for (long i = 0; i < MSG_COUNT; ++i) {
91-
ackSet.add(i);
90+
ackSet.add(ch.getNextPublishSeqNo());
9291
ch.basicPublish("", QUEUE_NAME,
9392
MessageProperties.PERSISTENT_BASIC,
9493
"nop".getBytes());

0 commit comments

Comments
 (0)