You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2022/04/26 00:41:32 UTC

[GitHub] [rocketmq] Oliverwqcwrw opened a new pull request, #4208: [Optimization] Replace Timer to ScheduleExecutorService

Oliverwqcwrw opened a new pull request, #4208:
URL: https://github.com/apache/rocketmq/pull/4208

   **Make sure set the target branch to `develop`**
   
   ## What is the purpose of the change
   
   Replace Timer to ScheduleExecutorService
   
   
   Follow this checklist to help us incorporate your contribution quickly and easily. Notice, `it would be helpful if you could finish the following 5 checklist(the last one is not necessary)before request the community to review your PR`.
   
   - [x] Make sure there is a [Github issue](https://github.com/apache/rocketmq/issues) filed for the change (usually before you start working on it). Trivial changes like typos do not require a Github issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue. 
   - [x] Format the pull request title like `[ISSUE #123] Fix UnknownException when host config not exist`. Each commit in the pull request should have a meaningful subject line and body.
   - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
   - [x] Write necessary unit-test(over 80% coverage) to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add integration-test in [test module](https://github.com/apache/rocketmq/tree/master/test).
   - [x] Run `mvn -B clean apache-rat:check findbugs:findbugs checkstyle:checkstyle` to make sure basic checks pass. Run `mvn clean install -DskipITs` to make sure unit-test pass. Run `mvn clean test-compile failsafe:integration-test`  to make sure integration-test pass.
   - [ ] If this contribution is large, please file an [Apache Individual Contributor License Agreement](http://www.apache.org/licenses/#clas).
   


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq] Oliverwqcwrw commented on a diff in pull request #4208: [Optimization] Replace Timer to ScheduleExecutorService

Posted by GitBox <gi...@apache.org>.
Oliverwqcwrw commented on code in PR #4208:
URL: https://github.com/apache/rocketmq/pull/4208#discussion_r858304168


##########
example/src/main/java/org/apache/rocketmq/example/benchmark/BatchProducer.java:
##########
@@ -317,7 +320,8 @@ class StatsBenchmarkBatchProducer {
 
     private final LongAdder sendMessageFailedCount = new LongAdder();
 
-    private final Timer timer = new Timer("BenchmarkTimerThread", true);
+    private final ScheduledExecutorService executorService = new ScheduledThreadPoolExecutor(1,
+            new BasicThreadFactory.Builder().namingPattern("BenchmarkTimerThread-%d").daemon(true).build());

Review Comment:
   Ok,Thanks for your suggestions



-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq] Oliverwqcwrw commented on pull request #4208: [Optimization] Replace Timer to ScheduleExecutorService

Posted by GitBox <gi...@apache.org>.
Oliverwqcwrw commented on PR #4208:
URL: https://github.com/apache/rocketmq/pull/4208#issuecomment-1109399857

   I have modified it,Please check if have other issue


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq] Oliverwqcwrw commented on a diff in pull request #4208: [Optimization] Replace Timer to ScheduleExecutorService

Posted by GitBox <gi...@apache.org>.
Oliverwqcwrw commented on code in PR #4208:
URL: https://github.com/apache/rocketmq/pull/4208#discussion_r858176312


##########
example/src/main/java/org/apache/rocketmq/example/benchmark/BatchProducer.java:
##########
@@ -360,17 +364,17 @@ public LongAdder getSendMessageFailedCount() {
 
     public void start() {
 
-        timer.scheduleAtFixedRate(new TimerTask() {
+        executorService.scheduleAtFixedRate(new TimerTask() {

Review Comment:
   Good idea



-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq] lwclover commented on a diff in pull request #4208: [Optimization] Replace Timer to ScheduleExecutorService

Posted by GitBox <gi...@apache.org>.
lwclover commented on code in PR #4208:
URL: https://github.com/apache/rocketmq/pull/4208#discussion_r858134790


##########
example/src/main/java/org/apache/rocketmq/example/benchmark/BatchProducer.java:
##########
@@ -360,17 +364,17 @@ public LongAdder getSendMessageFailedCount() {
 
     public void start() {
 
-        timer.scheduleAtFixedRate(new TimerTask() {
+        executorService.scheduleAtFixedRate(new TimerTask() {

Review Comment:
   It seems better to implement Runnable anonymously



##########
example/src/main/java/org/apache/rocketmq/example/benchmark/BatchProducer.java:
##########
@@ -317,7 +320,8 @@ class StatsBenchmarkBatchProducer {
 
     private final LongAdder sendMessageFailedCount = new LongAdder();
 
-    private final Timer timer = new Timer("BenchmarkTimerThread", true);
+    private final ScheduledExecutorService executorService = new ScheduledThreadPoolExecutor(1,
+            new BasicThreadFactory.Builder().namingPattern("BenchmarkTimerThread-%d").daemon(true).build());

Review Comment:
   A unified style is recommended



-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq] Oliverwqcwrw commented on a diff in pull request #4208: [Optimization] Replace Timer to ScheduleExecutorService

Posted by GitBox <gi...@apache.org>.
Oliverwqcwrw commented on code in PR #4208:
URL: https://github.com/apache/rocketmq/pull/4208#discussion_r858242647


##########
example/src/main/java/org/apache/rocketmq/example/benchmark/BatchProducer.java:
##########
@@ -360,17 +364,17 @@ public LongAdder getSendMessageFailedCount() {
 
     public void start() {
 
-        timer.scheduleAtFixedRate(new TimerTask() {
+        executorService.scheduleAtFixedRate(new TimerTask() {

Review Comment:
   Ok



-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq] cserwen commented on a diff in pull request #4208: [Optimization] Replace Timer to ScheduleExecutorService

Posted by GitBox <gi...@apache.org>.
cserwen commented on code in PR #4208:
URL: https://github.com/apache/rocketmq/pull/4208#discussion_r858326875


##########
example/src/main/java/org/apache/rocketmq/example/benchmark/BatchProducer.java:
##########
@@ -317,7 +318,8 @@ class StatsBenchmarkBatchProducer {
 
     private final LongAdder sendMessageFailedCount = new LongAdder();
 
-    private final Timer timer = new Timer("BenchmarkTimerThread", true);
+    private final ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor(new ThreadFactoryImpl(
+            "BenchmarkTimerThread"));

Review Comment:
   daemon thread



-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq] duhenglucky merged pull request #4208: [Optimization] Replace Timer to ScheduleExecutorService

Posted by GitBox <gi...@apache.org>.
duhenglucky merged PR #4208:
URL: https://github.com/apache/rocketmq/pull/4208


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq] cserwen commented on a diff in pull request #4208: [Optimization] Replace Timer to ScheduleExecutorService

Posted by GitBox <gi...@apache.org>.
cserwen commented on code in PR #4208:
URL: https://github.com/apache/rocketmq/pull/4208#discussion_r858170216


##########
example/src/main/java/org/apache/rocketmq/example/benchmark/BatchProducer.java:
##########
@@ -317,7 +320,8 @@ class StatsBenchmarkBatchProducer {
 
     private final LongAdder sendMessageFailedCount = new LongAdder();
 
-    private final Timer timer = new Timer("BenchmarkTimerThread", true);
+    private final ScheduledExecutorService executorService = new ScheduledThreadPoolExecutor(1,
+            new BasicThreadFactory.Builder().namingPattern("BenchmarkTimerThread-%d").daemon(true).build());

Review Comment:
   Maybe it's better to use `ThreadFactoryImpl`, just like this:
   https://github.com/apache/rocketmq/blob/5d0102396031b728f9accfa5a562fe20906ac424/broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java#L136



-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq] Oliverwqcwrw commented on a diff in pull request #4208: [Optimization] Replace Timer to ScheduleExecutorService

Posted by GitBox <gi...@apache.org>.
Oliverwqcwrw commented on code in PR #4208:
URL: https://github.com/apache/rocketmq/pull/4208#discussion_r858244391


##########
example/src/main/java/org/apache/rocketmq/example/benchmark/BatchProducer.java:
##########
@@ -317,7 +320,8 @@ class StatsBenchmarkBatchProducer {
 
     private final LongAdder sendMessageFailedCount = new LongAdder();
 
-    private final Timer timer = new Timer("BenchmarkTimerThread", true);
+    private final ScheduledExecutorService executorService = new ScheduledThreadPoolExecutor(1,
+            new BasicThreadFactory.Builder().namingPattern("BenchmarkTimerThread-%d").daemon(true).build());

Review Comment:
   I don't get your meaning,Can you provide more detail info



-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq] lwclover commented on pull request #4208: [Optimization] Replace Timer to ScheduleExecutorService

Posted by GitBox <gi...@apache.org>.
lwclover commented on PR #4208:
URL: https://github.com/apache/rocketmq/pull/4208#issuecomment-1109188644

   Two small suggestions.


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq] coveralls commented on pull request #4208: [Optimization] Replace Timer to ScheduleExecutorService

Posted by GitBox <gi...@apache.org>.
coveralls commented on PR #4208:
URL: https://github.com/apache/rocketmq/pull/4208#issuecomment-1109550675

   
   [![Coverage Status](https://coveralls.io/builds/48570919/badge)](https://coveralls.io/builds/48570919)
   
   Coverage increased (+0.07%) to 52.068% when pulling **1a61d3cb77a1134f8ba321b1108e3873a079e47b on Oliverwqcwrw:develop-replace-timer-2** into **9de7be47850684c329cc6d324b01950386c5963b on apache:develop**.
   


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq] Oliverwqcwrw commented on a diff in pull request #4208: [Optimization] Replace Timer to ScheduleExecutorService

Posted by GitBox <gi...@apache.org>.
Oliverwqcwrw commented on code in PR #4208:
URL: https://github.com/apache/rocketmq/pull/4208#discussion_r859270348


##########
example/src/main/java/org/apache/rocketmq/example/benchmark/BatchProducer.java:
##########
@@ -317,7 +318,8 @@ class StatsBenchmarkBatchProducer {
 
     private final LongAdder sendMessageFailedCount = new LongAdder();
 
-    private final Timer timer = new Timer("BenchmarkTimerThread", true);
+    private final ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor(new ThreadFactoryImpl(
+            "BenchmarkTimerThread", Boolean.TRUE));

Review Comment:
   AFAIK, if indent is wrong,the checking will not passing



-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq] cserwen commented on a diff in pull request #4208: [Optimization] Replace Timer to ScheduleExecutorService

Posted by GitBox <gi...@apache.org>.
cserwen commented on code in PR #4208:
URL: https://github.com/apache/rocketmq/pull/4208#discussion_r858172403


##########
example/src/main/java/org/apache/rocketmq/example/benchmark/BatchProducer.java:
##########
@@ -360,17 +364,17 @@ public LongAdder getSendMessageFailedCount() {
 
     public void start() {
 
-        timer.scheduleAtFixedRate(new TimerTask() {
+        executorService.scheduleAtFixedRate(new TimerTask() {

Review Comment:
   The code can be more concise, such as using a lambda expression



-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq] codecov-commenter commented on pull request #4208: [Optimization] Replace Timer to ScheduleExecutorService

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #4208:
URL: https://github.com/apache/rocketmq/pull/4208#issuecomment-1109549451

   # [Codecov](https://codecov.io/gh/apache/rocketmq/pull/4208?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#4208](https://codecov.io/gh/apache/rocketmq/pull/4208?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (1a61d3c) into [develop](https://codecov.io/gh/apache/rocketmq/commit/5d0102396031b728f9accfa5a562fe20906ac424?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (5d01023) will **decrease** coverage by `0.24%`.
   > The diff coverage is `n/a`.
   
   ```diff
   @@              Coverage Diff              @@
   ##             develop    #4208      +/-   ##
   =============================================
   - Coverage      48.13%   47.88%   -0.25%     
   + Complexity      5038     5006      -32     
   =============================================
     Files            636      636              
     Lines          42506    42506              
     Branches        5568     5568              
   =============================================
   - Hits           20459    20353     -106     
   - Misses         19564    19663      +99     
   - Partials        2483     2490       +7     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/rocketmq/pull/4208?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [.../broker/subscription/SubscriptionGroupManager.java](https://codecov.io/gh/apache/rocketmq/pull/4208/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9icm9rZXIvc3Vic2NyaXB0aW9uL1N1YnNjcmlwdGlvbkdyb3VwTWFuYWdlci5qYXZh) | `64.70% <0.00%> (-16.48%)` | :arrow_down: |
   | [...rg/apache/rocketmq/common/stats/StatsSnapshot.java](https://codecov.io/gh/apache/rocketmq/pull/4208/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jb21tb24vc3RhdHMvU3RhdHNTbmFwc2hvdC5qYXZh) | `84.61% <0.00%> (-15.39%)` | :arrow_down: |
   | [.../apache/rocketmq/common/stats/MomentStatsItem.java](https://codecov.io/gh/apache/rocketmq/pull/4208/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jb21tb24vc3RhdHMvTW9tZW50U3RhdHNJdGVtLmphdmE=) | `38.09% <0.00%> (-9.53%)` | :arrow_down: |
   | [...org/apache/rocketmq/common/stats/StatsItemSet.java](https://codecov.io/gh/apache/rocketmq/pull/4208/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jb21tb24vc3RhdHMvU3RhdHNJdGVtU2V0LmphdmE=) | `44.77% <0.00%> (-8.96%)` | :arrow_down: |
   | [...ache/rocketmq/common/stats/MomentStatsItemSet.java](https://codecov.io/gh/apache/rocketmq/pull/4208/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jb21tb24vc3RhdHMvTW9tZW50U3RhdHNJdGVtU2V0LmphdmE=) | `39.13% <0.00%> (-8.70%)` | :arrow_down: |
   | [...va/org/apache/rocketmq/common/stats/StatsItem.java](https://codecov.io/gh/apache/rocketmq/pull/4208/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jb21tb24vc3RhdHMvU3RhdHNJdGVtLmphdmE=) | `50.00% <0.00%> (-5.00%)` | :arrow_down: |
   | [...apache/rocketmq/remoting/netty/ResponseFuture.java](https://codecov.io/gh/apache/rocketmq/pull/4208/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVtb3Rpbmcvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3JvY2tldG1xL3JlbW90aW5nL25ldHR5L1Jlc3BvbnNlRnV0dXJlLmphdmE=) | `85.00% <0.00%> (-5.00%)` | :arrow_down: |
   | [...ketmq/common/protocol/body/ConsumerConnection.java](https://codecov.io/gh/apache/rocketmq/pull/4208/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jb21tb24vcHJvdG9jb2wvYm9keS9Db25zdW1lckNvbm5lY3Rpb24uamF2YQ==) | `95.83% <0.00%> (-4.17%)` | :arrow_down: |
   | [...rocketmq/remoting/netty/NettyRemotingAbstract.java](https://codecov.io/gh/apache/rocketmq/pull/4208/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVtb3Rpbmcvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3JvY2tldG1xL3JlbW90aW5nL25ldHR5L05ldHR5UmVtb3RpbmdBYnN0cmFjdC5qYXZh) | `46.88% <0.00%> (-4.03%)` | :arrow_down: |
   | [...lient/impl/consumer/DefaultMQPushConsumerImpl.java](https://codecov.io/gh/apache/rocketmq/pull/4208/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y2xpZW50L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jbGllbnQvaW1wbC9jb25zdW1lci9EZWZhdWx0TVFQdXNoQ29uc3VtZXJJbXBsLmphdmE=) | `40.17% <0.00%> (-3.86%)` | :arrow_down: |
   | ... and [19 more](https://codecov.io/gh/apache/rocketmq/pull/4208/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/rocketmq/pull/4208?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/rocketmq/pull/4208?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [5d01023...1a61d3c](https://codecov.io/gh/apache/rocketmq/pull/4208?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq] HScarb commented on pull request #4208: [Optimization] Replace Timer to ScheduleExecutorService

Posted by GitBox <gi...@apache.org>.
HScarb commented on PR #4208:
URL: https://github.com/apache/rocketmq/pull/4208#issuecomment-1109236500

   The client module will be compile with jdk 1.7 or jdk 1.6, which not support lambda


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq] HScarb commented on a diff in pull request #4208: [Optimization] Replace Timer to ScheduleExecutorService

Posted by GitBox <gi...@apache.org>.
HScarb commented on code in PR #4208:
URL: https://github.com/apache/rocketmq/pull/4208#discussion_r858942952


##########
example/src/main/java/org/apache/rocketmq/example/benchmark/BatchProducer.java:
##########
@@ -317,7 +318,8 @@ class StatsBenchmarkBatchProducer {
 
     private final LongAdder sendMessageFailedCount = new LongAdder();
 
-    private final Timer timer = new Timer("BenchmarkTimerThread", true);
+    private final ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor(new ThreadFactoryImpl(
+            "BenchmarkTimerThread", Boolean.TRUE));

Review Comment:
   The indent here maybe wrong, pls import rmq_codeStyle.xml in style folder and reformat the code



-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq] coveralls commented on pull request #4208: [Optimization] Replace Timer to ScheduleExecutorService

Posted by GitBox <gi...@apache.org>.
coveralls commented on PR #4208:
URL: https://github.com/apache/rocketmq/pull/4208#issuecomment-1109550683

   
   [![Coverage Status](https://coveralls.io/builds/48570919/badge)](https://coveralls.io/builds/48570919)
   
   Coverage increased (+0.07%) to 52.068% when pulling **1a61d3cb77a1134f8ba321b1108e3873a079e47b on Oliverwqcwrw:develop-replace-timer-2** into **9de7be47850684c329cc6d324b01950386c5963b on apache:develop**.
   


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq] Oliverwqcwrw commented on a diff in pull request #4208: [Optimization] Replace Timer to ScheduleExecutorService

Posted by GitBox <gi...@apache.org>.
Oliverwqcwrw commented on code in PR #4208:
URL: https://github.com/apache/rocketmq/pull/4208#discussion_r858177776


##########
example/src/main/java/org/apache/rocketmq/example/benchmark/BatchProducer.java:
##########
@@ -317,7 +320,8 @@ class StatsBenchmarkBatchProducer {
 
     private final LongAdder sendMessageFailedCount = new LongAdder();
 
-    private final Timer timer = new Timer("BenchmarkTimerThread", true);
+    private final ScheduledExecutorService executorService = new ScheduledThreadPoolExecutor(1,
+            new BasicThreadFactory.Builder().namingPattern("BenchmarkTimerThread-%d").daemon(true).build());

Review Comment:
   Emmm, I prefer to like present way



-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq] Oliverwqcwrw commented on a diff in pull request #4208: [Optimization] Replace Timer to ScheduleExecutorService

Posted by GitBox <gi...@apache.org>.
Oliverwqcwrw commented on code in PR #4208:
URL: https://github.com/apache/rocketmq/pull/4208#discussion_r858337640


##########
example/src/main/java/org/apache/rocketmq/example/benchmark/BatchProducer.java:
##########
@@ -317,7 +318,8 @@ class StatsBenchmarkBatchProducer {
 
     private final LongAdder sendMessageFailedCount = new LongAdder();
 
-    private final Timer timer = new Timer("BenchmarkTimerThread", true);
+    private final ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor(new ThreadFactoryImpl(
+            "BenchmarkTimerThread"));

Review Comment:
   Thanks for your checking,I have solved it



-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq] lwclover commented on a diff in pull request #4208: [Optimization] Replace Timer to ScheduleExecutorService

Posted by GitBox <gi...@apache.org>.
lwclover commented on code in PR #4208:
URL: https://github.com/apache/rocketmq/pull/4208#discussion_r858288156


##########
example/src/main/java/org/apache/rocketmq/example/benchmark/BatchProducer.java:
##########
@@ -317,7 +320,8 @@ class StatsBenchmarkBatchProducer {
 
     private final LongAdder sendMessageFailedCount = new LongAdder();
 
-    private final Timer timer = new Timer("BenchmarkTimerThread", true);
+    private final ScheduledExecutorService executorService = new ScheduledThreadPoolExecutor(1,
+            new BasicThreadFactory.Builder().namingPattern("BenchmarkTimerThread-%d").daemon(true).build());

Review Comment:
   same as @cserwen mentioned.



-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org