Skip to content

Commit 7bd03ea

Browse files
author
Matthias Radestock
committed
prevent divide-by-zero error
1 parent d52a1a5 commit 7bd03ea

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -380,10 +380,12 @@ public void run() {
380380
throw new RuntimeException(e);
381381
}
382382

383-
System.out.println("recving rate avg: " +
384-
(totalMsgCount * 1000 / (now - startTime)) +
385-
" msg/s");
386-
383+
long elapsed = now - startTime;
384+
if (elapsed > 0) {
385+
System.out.println("recving rate avg: " +
386+
(totalMsgCount * 1000 / elapsed) +
387+
" msg/s");
388+
}
387389
}
388390

389391
}

0 commit comments

Comments
 (0)