This is an automated email from the ASF dual-hosted git repository.

jinrongtong pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/rocketmq.git


The following commit(s) were added to refs/heads/develop by this push:
     new 59220d8f58 [ISSUE #7966] fix: avoid scheduled tasks exiting because of 
unknown exceptions
59220d8f58 is described below

commit 59220d8f582a329c5f9e775c371f57ec1ff3ff39
Author: cserwen <cser...@apache.org>
AuthorDate: Tue Mar 26 18:43:42 2024 +0800

    [ISSUE #7966] fix: avoid scheduled tasks exiting because of unknown 
exceptions
    
    Co-authored-by: dengzhiwen1 <dengzhiw...@xiaomi.com>
---
 .../client/impl/factory/MQClientInstance.java        | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git 
a/client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java
 
b/client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java
index 436782efd3..227f3346d0 100644
--- 
a/client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java
+++ 
b/client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java
@@ -333,8 +333,8 @@ public class MQClientInstance {
             this.scheduledExecutorService.scheduleAtFixedRate(() -> {
                 try {
                     
MQClientInstance.this.mQClientAPIImpl.fetchNameServerAddr();
-                } catch (Exception e) {
-                    log.error("ScheduledTask fetchNameServerAddr exception", 
e);
+                } catch (Throwable t) {
+                    log.error("ScheduledTask fetchNameServerAddr exception", 
t);
                 }
             }, 1000 * 10, 1000 * 60 * 2, TimeUnit.MILLISECONDS);
         }
@@ -342,8 +342,8 @@ public class MQClientInstance {
         this.scheduledExecutorService.scheduleAtFixedRate(() -> {
             try {
                 MQClientInstance.this.updateTopicRouteInfoFromNameServer();
-            } catch (Exception e) {
-                log.error("ScheduledTask updateTopicRouteInfoFromNameServer 
exception", e);
+            } catch (Throwable t) {
+                log.error("ScheduledTask updateTopicRouteInfoFromNameServer 
exception", t);
             }
         }, 10, this.clientConfig.getPollNameServerInterval(), 
TimeUnit.MILLISECONDS);
 
@@ -351,24 +351,24 @@ public class MQClientInstance {
             try {
                 MQClientInstance.this.cleanOfflineBroker();
                 MQClientInstance.this.sendHeartbeatToAllBrokerWithLock();
-            } catch (Exception e) {
-                log.error("ScheduledTask sendHeartbeatToAllBroker exception", 
e);
+            } catch (Throwable t) {
+                log.error("ScheduledTask sendHeartbeatToAllBroker exception", 
t);
             }
         }, 1000, this.clientConfig.getHeartbeatBrokerInterval(), 
TimeUnit.MILLISECONDS);
 
         this.scheduledExecutorService.scheduleAtFixedRate(() -> {
             try {
                 MQClientInstance.this.persistAllConsumerOffset();
-            } catch (Exception e) {
-                log.error("ScheduledTask persistAllConsumerOffset exception", 
e);
+            } catch (Throwable t) {
+                log.error("ScheduledTask persistAllConsumerOffset exception", 
t);
             }
         }, 1000 * 10, this.clientConfig.getPersistConsumerOffsetInterval(), 
TimeUnit.MILLISECONDS);
 
         this.scheduledExecutorService.scheduleAtFixedRate(() -> {
             try {
                 MQClientInstance.this.adjustThreadPool();
-            } catch (Exception e) {
-                log.error("ScheduledTask adjustThreadPool exception", e);
+            } catch (Throwable t) {
+                log.error("ScheduledTask adjustThreadPool exception", t);
             }
         }, 1, 1, TimeUnit.MINUTES);
     }

Reply via email to