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

liujun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git


The following commit(s) were added to refs/heads/master by this push:
     new c271039  Merge pull request #1997, clienthandler in netty4 should 
trigger heartbeat handler.
c271039 is described below

commit c2710393e01973bcdc549192e0d25a80272ccc27
Author: yì jí <[email protected]>
AuthorDate: Fri Jun 29 14:16:32 2018 +0800

    Merge pull request #1997, clienthandler in netty4 should trigger heartbeat 
handler.
    
    Fixes #1996 .
    * Remove unuseful 'disconnect()' method since netty4
    * trigger heartbeat
---
 .../dubbo/remoting/transport/netty4/NettyClientHandler.java | 13 ++++++-------
 .../dubbo/remoting/transport/netty4/NettyServerHandler.java |  9 ---------
 2 files changed, 6 insertions(+), 16 deletions(-)

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 c3f46d5..88cc150 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 class NettyClientHandler extends 
ChannelDuplexHandler {
 
     @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 88d5453..ba30062 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 class NettyServerHandler extends ChannelDuplexHandler {
 
     @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 class NettyServerHandler extends ChannelDuplexHandler 
{
         }
     }
 
-
-    @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);

Reply via email to