Skip to content

Commit

Permalink
[3.0] catch handler.caught() throwable of MultiMessageHandler (#8930)
Browse files Browse the repository at this point in the history
* catch handler.caught() throwable of MultiMessageHandler

* remove useless import, fix ut
  • Loading branch information
zrlw committed Sep 27, 2021
1 parent cd5cad2 commit 40d01ee
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
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;

Expand All @@ -43,9 +42,13 @@ public void received(Channel channel, Object message) throws RemotingException {
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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,15 @@ public void after() throws Exception {
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")
Expand Down

0 comments on commit 40d01ee

Please sign in to comment.