You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by al...@apache.org on 2021/09/27 11:47:41 UTC
[dubbo] branch master updated: catch handler.caught() throwable of
MultiMessageHandler (#8931)
This is an automated email from the ASF dual-hosted git repository.
albumenj pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/master by this push:
new a38e4fb catch handler.caught() throwable of MultiMessageHandler (#8931)
a38e4fb is described below
commit a38e4fb9eda8760ee7069c19c9c921142e746696
Author: zrlw <zr...@sina.com>
AuthorDate: Mon Sep 27 19:47:28 2021 +0800
catch handler.caught() throwable of MultiMessageHandler (#8931)
---
.../apache/dubbo/remoting/transport/MultiMessageHandler.java | 11 +++++++----
.../exchange/support/header/HeartbeatHandlerTest.java | 3 +++
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/transport/MultiMessageHandler.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/transport/MultiMessageHandler.java
index 4a173d6..0dad522 100644
--- a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/transport/MultiMessageHandler.java
+++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/transport/MultiMessageHandler.java
@@ -20,7 +20,6 @@ import org.apache.dubbo.common.logger.Logger;
import org.apache.dubbo.common.logger.LoggerFactory;
import org.apache.dubbo.remoting.Channel;
import org.apache.dubbo.remoting.ChannelHandler;
-import org.apache.dubbo.remoting.ExecutionException;
import org.apache.dubbo.remoting.RemotingException;
import org.apache.dubbo.remoting.exchange.support.MultiMessage;
@@ -43,9 +42,13 @@ public class MultiMessageHandler extends AbstractChannelHandlerDelegate {
for (Object obj : list) {
try {
handler.received(channel, obj);
- } catch (ExecutionException e) {
- logger.error("MultiMessageHandler received fail.", e);
- handler.caught(channel, e);
+ } catch (Throwable t) {
+ logger.error("MultiMessageHandler received fail.", t);
+ try {
+ handler.caught(channel, t);
+ } catch (Throwable t1) {
+ logger.error("MultiMessageHandler caught fail.", t1);
+ }
}
}
} else {
diff --git a/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/exchange/support/header/HeartbeatHandlerTest.java b/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/exchange/support/header/HeartbeatHandlerTest.java
index eda4b60..9836dff 100644
--- a/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/exchange/support/header/HeartbeatHandlerTest.java
+++ b/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/exchange/support/header/HeartbeatHandlerTest.java
@@ -57,12 +57,15 @@ public class HeartbeatHandlerTest {
server = null;
}
+ FakeChannelHandlers.resetChannelHandlers();
+
// wait for timer to finish
Thread.sleep(2000);
}
@Test
public void testServerHeartbeat() throws Exception {
+ FakeChannelHandlers.resetChannelHandlers();
URL serverURL = URL.valueOf("telnet://localhost:" + NetUtils.getAvailablePort(56780))
.addParameter(Constants.EXCHANGER_KEY, HeaderExchanger.NAME)
.addParameter(Constants.TRANSPORTER_KEY, "netty3")