xxd763795151 commented on a change in pull request #2617:
URL: https://github.com/apache/rocketmq/pull/2617#discussion_r580018406



##########
File path: 
example/src/main/java/org/apache/rocketmq/example/benchmark/Producer.java
##########
@@ -198,10 +209,27 @@ public void run() {
                             } catch (InterruptedException ignored) {
                             }
                         }
+                        if (messageNum > 0 && ++num >= msgNumLimit) {
+                            break;
+                        }
                     }
                 }
             });
         }
+        try {
+            sendThreadPool.shutdown();
+            sendThreadPool.awaitTermination(Long.MAX_VALUE, TimeUnit.DAYS);
+            timer.cancel();
+            if (snapshotList.size() > 1) {
+                doPrintStats(snapshotList, statsBenchmark, true);
+            } else {
+                System.out.printf("[Complete] Send Total: %d Send Failed: %d 
Response Failed: %d%n",
+                    statsBenchmark.getSendRequestSuccessCount().get() + 
statsBenchmark.getSendRequestFailedCount().get(),
+                    statsBenchmark.getSendRequestFailedCount().get(), 
statsBenchmark.getReceiveResponseFailedCount().get());
+            }
+            producer.shutdown();
+        } catch (InterruptedException ignored) {

Review comment:
       emmmm...I look elsewhere in the code, there are not any action about the 
InterruptedException. So I keep the original code style doing not print the 
exception message there.
   If necessary I can catch the Exception instead of InterruptedException there 
and invoking e.printStackTrace(), may be better. What do you think, do I make 
this adjusetment?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to