[ROCKETMQ-238] Catch Throwable to avoid error cancel some key scheduled tasks.


Project: http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/commit/9ad9ad06
Tree: http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/tree/9ad9ad06
Diff: http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/diff/9ad9ad06

Branch: refs/heads/master
Commit: 9ad9ad064f32470ae7e61ca3c400c680e8ab5ab4
Parents: b70b680
Author: yukon <yu...@apache.org>
Authored: Wed Jul 5 14:48:16 2017 +0800
Committer: yukon <yu...@apache.org>
Committed: Wed Jul 5 14:48:16 2017 +0800

----------------------------------------------------------------------
 .../main/java/org/apache/rocketmq/broker/BrokerController.java   | 4 ++--
 .../apache/rocketmq/broker/client/ClientHousekeepingService.java | 4 ++--
 .../org/apache/rocketmq/remoting/netty/NettyRemotingClient.java  | 2 +-
 .../org/apache/rocketmq/remoting/netty/NettyRemotingServer.java  | 2 +-
 .../main/java/org/apache/rocketmq/store/DefaultMessageStore.java | 4 ++--
 .../apache/rocketmq/store/schedule/ScheduleMessageService.java   | 2 +-
 6 files changed, 9 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/9ad9ad06/broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java
----------------------------------------------------------------------
diff --git 
a/broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java 
b/broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java
index 1416ebf..53968fa 100644
--- a/broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java
+++ b/broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java
@@ -296,7 +296,7 @@ public class BrokerController {
                 public void run() {
                     try {
                         BrokerController.this.protectBroker();
-                    } catch (Exception e) {
+                    } catch (Throwable e) {
                         log.error("protectBroker error.", e);
                     }
                 }
@@ -307,7 +307,7 @@ public class BrokerController {
                 public void run() {
                     try {
                         BrokerController.this.printWaterMark();
-                    } catch (Exception e) {
+                    } catch (Throwable e) {
                         log.error("printWaterMark error.", e);
                     }
                 }

http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/9ad9ad06/broker/src/main/java/org/apache/rocketmq/broker/client/ClientHousekeepingService.java
----------------------------------------------------------------------
diff --git 
a/broker/src/main/java/org/apache/rocketmq/broker/client/ClientHousekeepingService.java
 
b/broker/src/main/java/org/apache/rocketmq/broker/client/ClientHousekeepingService.java
index 559dac1..c61531c 100644
--- 
a/broker/src/main/java/org/apache/rocketmq/broker/client/ClientHousekeepingService.java
+++ 
b/broker/src/main/java/org/apache/rocketmq/broker/client/ClientHousekeepingService.java
@@ -45,8 +45,8 @@ public class ClientHousekeepingService implements 
ChannelEventListener {
             public void run() {
                 try {
                     ClientHousekeepingService.this.scanExceptionChannel();
-                } catch (Exception e) {
-                    log.error("", e);
+                } catch (Throwable e) {
+                    log.error("Error occurred when scan not active client 
channels.", e);
                 }
             }
         }, 1000 * 10, 1000 * 10, TimeUnit.MILLISECONDS);

http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/9ad9ad06/remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java
----------------------------------------------------------------------
diff --git 
a/remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java
 
b/remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java
index 1c3da9a..db6a7e4 100644
--- 
a/remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java
+++ 
b/remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java
@@ -166,7 +166,7 @@ public class NettyRemotingClient extends 
NettyRemotingAbstract implements Remoti
             public void run() {
                 try {
                     NettyRemotingClient.this.scanResponseTable();
-                } catch (Exception e) {
+                } catch (Throwable e) {
                     log.error("scanResponseTable exception", e);
                 }
             }

http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/9ad9ad06/remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingServer.java
----------------------------------------------------------------------
diff --git 
a/remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingServer.java
 
b/remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingServer.java
index a9a55ab..b2041b2 100644
--- 
a/remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingServer.java
+++ 
b/remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingServer.java
@@ -195,7 +195,7 @@ public class NettyRemotingServer extends 
NettyRemotingAbstract implements Remoti
             public void run() {
                 try {
                     NettyRemotingServer.this.scanResponseTable();
-                } catch (Exception e) {
+                } catch (Throwable e) {
                     log.error("scanResponseTable exception", e);
                 }
             }

http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/9ad9ad06/store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java
----------------------------------------------------------------------
diff --git 
a/store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java 
b/store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java
index 4549f1e..b5bac3f 100644
--- a/store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java
+++ b/store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java
@@ -1443,7 +1443,7 @@ public class DefaultMessageStore implements MessageStore {
                 this.deleteExpiredFiles();
 
                 this.redeleteHangedFile();
-            } catch (Exception e) {
+            } catch (Throwable e) {
                 DefaultMessageStore.log.warn(this.getServiceName() + " service 
has exception. ", e);
             }
         }
@@ -1583,7 +1583,7 @@ public class DefaultMessageStore implements MessageStore {
         public void run() {
             try {
                 this.deleteExpiredFiles();
-            } catch (Exception e) {
+            } catch (Throwable e) {
                 DefaultMessageStore.log.warn(this.getServiceName() + " service 
has exception. ", e);
             }
         }

http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/9ad9ad06/store/src/main/java/org/apache/rocketmq/store/schedule/ScheduleMessageService.java
----------------------------------------------------------------------
diff --git 
a/store/src/main/java/org/apache/rocketmq/store/schedule/ScheduleMessageService.java
 
b/store/src/main/java/org/apache/rocketmq/store/schedule/ScheduleMessageService.java
index 172954d..012a4f0 100644
--- 
a/store/src/main/java/org/apache/rocketmq/store/schedule/ScheduleMessageService.java
+++ 
b/store/src/main/java/org/apache/rocketmq/store/schedule/ScheduleMessageService.java
@@ -121,7 +121,7 @@ public class ScheduleMessageService extends ConfigManager {
             public void run() {
                 try {
                     ScheduleMessageService.this.persist();
-                } catch (Exception e) {
+                } catch (Throwable e) {
                     log.error("scheduleAtFixedRate flush exception", e);
                 }
             }

Reply via email to