chickenlj closed pull request #1997: [Dubbo- netty4 nettyclienthandler should
trigger heartbeat handler] fix heartbeat when channel active
URL: https://github.com/apache/incubator-dubbo/pull/1997
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git
a/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyClientHandler.java
b/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyClientHandler.java
index c3f46d5236..88cc1508aa 100644
---
a/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyClientHandler.java
+++
b/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyClientHandler.java
@@ -47,17 +47,16 @@ public NettyClientHandler(URL url, ChannelHandler handler) {
@Override
public void channelActive(ChannelHandlerContext ctx) throws Exception {
- ctx.fireChannelActive();
+ NettyChannel channel = NettyChannel.getOrAddChannel(ctx.channel(),
url, handler);
+ try {
+ handler.connected(channel);
+ } finally {
+ NettyChannel.removeChannelIfDisconnected(ctx.channel());
+ }
}
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
- ctx.fireChannelInactive();
- }
-
- @Override
- public void disconnect(ChannelHandlerContext ctx, ChannelPromise future)
- throws Exception {
NettyChannel channel = NettyChannel.getOrAddChannel(ctx.channel(),
url, handler);
try {
handler.disconnected(channel);
diff --git
a/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyServerHandler.java
b/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyServerHandler.java
index 88d54537ab..ba300623e8 100644
---
a/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyServerHandler.java
+++
b/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyServerHandler.java
@@ -58,8 +58,6 @@ public NettyServerHandler(URL url, ChannelHandler handler) {
@Override
public void channelActive(ChannelHandlerContext ctx) throws Exception {
- ctx.fireChannelActive();
-
NettyChannel channel = NettyChannel.getOrAddChannel(ctx.channel(),
url, handler);
try {
if (channel != null) {
@@ -82,13 +80,6 @@ public void channelInactive(ChannelHandlerContext ctx)
throws Exception {
}
}
-
- @Override
- public void disconnect(ChannelHandlerContext ctx, ChannelPromise future)
- throws Exception {
-
- }
-
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws
Exception {
NettyChannel channel = NettyChannel.getOrAddChannel(ctx.channel(),
url, handler);
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]