File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
test/src/com/rabbitmq/examples Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -236,14 +236,16 @@ public void run() {
236236 long now ;
237237 now = startTime = lastStatsTime = System .currentTimeMillis ();
238238 msgCount = 0 ;
239- int totalMsgCount = 1 ;
239+ int totalMsgCount = 0 ;
240240
241241 try {
242242
243- for (; timeLimit == 0 || now < startTime + timeLimit ;
244- totalMsgCount ++, msgCount ++) {
243+ while (timeLimit == 0 || now < startTime + timeLimit ) {
245244 delay (now );
246245 publish (createMessage (totalMsgCount ));
246+ totalMsgCount ++;
247+ msgCount ++;
248+
247249 if (txSize != 0 && totalMsgCount % txSize == 0 ) {
248250 channel .txCommit ();
249251 }
@@ -340,21 +342,21 @@ public void run() {
340342 long now ;
341343 long startTime ;
342344 startTime = now = System .currentTimeMillis ();
343- int totalMsgCount = 1 ;
345+ int totalMsgCount = 0 ;
344346
345347 Channel channel = q .getChannel ();
346348
347349 try {
348350
349- for (; timeLimit == 0 || now < startTime + timeLimit ;
350- totalMsgCount ++) {
351+ while (timeLimit == 0 || now < startTime + timeLimit ) {
351352 Delivery delivery ;
352353 if (timeLimit == 0 ) {
353354 delivery = q .nextDelivery ();
354355 } else {
355356 delivery = q .nextDelivery (startTime + timeLimit - now );
356357 if (delivery == null ) break ;
357358 }
359+ totalMsgCount ++;
358360
359361 DataInputStream d = new DataInputStream (new ByteArrayInputStream (delivery .getBody ()));
360362 int msgSeq = d .readInt ();
You can’t perform that action at this time.
0 commit comments