Skip to content

Commit 0aa5c06

Browse files
author
Alexandru Scvortov
committed
MCM: confirms are shown as confirms/s (similar to basic returns)
1 parent 17c4574 commit 0aa5c06

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

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

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,8 @@ public static class Producer implements Runnable, ReturnListener, AckListener {
245245
private int basicReturnCount;
246246

247247
private long confirmMax;
248-
private long mostRecentAcked;
248+
private long mostRecentConfirmed;
249+
private long confirmCount;
249250

250251
public Producer(Channel channel, String exchangeName, String id,
251252
List flags, int txSize,
@@ -288,8 +289,13 @@ public void handleAck(long sequenceNumber, boolean multiple) {
288289
logAck(sequenceNumber);
289290
}
290291

292+
private synchronized void resetConfirms() {
293+
confirmCount = 0;
294+
}
295+
291296
private synchronized void logAck(long seqNum) {
292-
mostRecentAcked = seqNum;
297+
mostRecentConfirmed = seqNum;
298+
confirmCount++;
293299
}
294300

295301
public void run() {
@@ -339,7 +345,7 @@ private void publish(byte[] msg)
339345
}
340346

341347
private boolean throttleConfirms() {
342-
return ((confirmMax > 0) && (channel.getNextPublishSeqNo() - mostRecentAcked > confirmMax));
348+
return ((confirmMax > 0) && (channel.getNextPublishSeqNo() - mostRecentConfirmed > confirmMax));
343349
}
344350

345351
private void delay(long now)
@@ -361,8 +367,12 @@ private void delay(long now)
361367
" msg/s" +
362368
", basic returns: " +
363369
(basicReturnCount * 1000L / elapsed) +
364-
" ret/s");
370+
" ret/s" +
371+
", confirms: " +
372+
(confirmCount * 1000L / elapsed) +
373+
" c/s");
365374
resetBasicReturns();
375+
resetConfirms();
366376
msgCount = 0;
367377
lastStatsTime = now;
368378
}

0 commit comments

Comments
 (0)