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/08/09 02:26:16 UTC

[GitHub] [rocketmq] caigy commented on a diff in pull request #4655: [ISSUE #4654] Use the scheduleWithFixedDelay instead of creating unnecessary DeliverDelayedMessageTimerTask and HandlePutResultTask objects

caigy commented on code in PR #4655:
URL: https://github.com/apache/rocketmq/pull/4655#discussion_r940826980


##########
broker/src/main/java/org/apache/rocketmq/broker/schedule/ScheduleMessageService.java:
##########
@@ -398,7 +398,12 @@ public void run() {
             } catch (Exception e) {
                 // XXX: warn and notify me
                 log.error("ScheduleMessageService, executeOnTimeup exception", e);
-                this.scheduleNextTimerTask(this.offset, DELAY_FOR_A_PERIOD);
+                try {
+                    // Wait for a period of time if an error has occurred.
+                    TimeUnit.MILLISECONDS.sleep(DELAY_FOR_A_PERIOD);
+                } catch (InterruptedException ex) {
+                    log.error("ScheduleMessageService, an error occurred while waiting", ex);

Review Comment:
   IMO interrupted flag should be restored (`Thread.currentThread().interrupt()`) after  `InterruptedException` is thrown. 



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