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

victory 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 cb1331e  issue #4699: 
org.apache.dubbo.remoting.exchange.support.DefaultFuture closeChannel doesn't 
work as expected (#4700)
cb1331e is described below

commit cb1331e04ff9eb7dd9ea94fcbb17d13c6f959134
Author: Ian Luo <ian....@gmail.com>
AuthorDate: Thu Sep 5 14:39:58 2019 +0800

    issue #4699: org.apache.dubbo.remoting.exchange.support.DefaultFuture 
closeChannel doesn't work as expected (#4700)
    
    * issue #4699: 
org.apache.dubbo.remoting.exchange.support.DefaultFuture#closeChannel doesn't 
work as expected
    
    * Revert "issue #4699: 
org.apache.dubbo.remoting.exchange.support.DefaultFuture#closeChannel doesn't 
work as expected"
---
 .../org/apache/dubbo/remoting/transport/netty/NettyChannel.java    | 7 +++++++
 .../org/apache/dubbo/remoting/transport/netty/NettyClient.java     | 4 ++++
 .../org/apache/dubbo/remoting/transport/netty4/NettyChannel.java   | 7 +++++++
 .../org/apache/dubbo/remoting/transport/netty4/NettyClient.java    | 4 ++++
 4 files changed, 22 insertions(+)

diff --git 
a/dubbo-remoting/dubbo-remoting-netty/src/main/java/org/apache/dubbo/remoting/transport/netty/NettyChannel.java
 
b/dubbo-remoting/dubbo-remoting-netty/src/main/java/org/apache/dubbo/remoting/transport/netty/NettyChannel.java
index 45633b9..cad57b9 100644
--- 
a/dubbo-remoting/dubbo-remoting-netty/src/main/java/org/apache/dubbo/remoting/transport/netty/NettyChannel.java
+++ 
b/dubbo-remoting/dubbo-remoting-netty/src/main/java/org/apache/dubbo/remoting/transport/netty/NettyChannel.java
@@ -185,6 +185,13 @@ final class NettyChannel extends AbstractChannel {
         if (obj == null) {
             return false;
         }
+
+        // FIXME: a hack to make 
org.apache.dubbo.remoting.exchange.support.DefaultFuture.closeChannel work
+        if (obj instanceof NettyClient) {
+            NettyClient client = (NettyClient) obj;
+            return channel.equals(client.getNettyChannel());
+        }
+
         if (getClass() != obj.getClass()) {
             return false;
         }
diff --git 
a/dubbo-remoting/dubbo-remoting-netty/src/main/java/org/apache/dubbo/remoting/transport/netty/NettyClient.java
 
b/dubbo-remoting/dubbo-remoting-netty/src/main/java/org/apache/dubbo/remoting/transport/netty/NettyClient.java
index e31edcc..dc26ffd 100644
--- 
a/dubbo-remoting/dubbo-remoting-netty/src/main/java/org/apache/dubbo/remoting/transport/netty/NettyClient.java
+++ 
b/dubbo-remoting/dubbo-remoting-netty/src/main/java/org/apache/dubbo/remoting/transport/netty/NettyClient.java
@@ -163,4 +163,8 @@ public class NettyClient extends AbstractClient {
         return NettyChannel.getOrAddChannel(c, getUrl(), this);
     }
 
+    Channel getNettyChannel() {
+        return channel;
+    }
+
 }
diff --git 
a/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyChannel.java
 
b/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyChannel.java
index f8bbcf6..53ffa47 100644
--- 
a/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyChannel.java
+++ 
b/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyChannel.java
@@ -218,6 +218,13 @@ final class NettyChannel extends AbstractChannel {
         if (obj == null) {
             return false;
         }
+
+        // FIXME: a hack to make 
org.apache.dubbo.remoting.exchange.support.DefaultFuture.closeChannel work
+        if (obj instanceof NettyClient) {
+            NettyClient client = (NettyClient) obj;
+            return channel.equals(client.getNettyChannel());
+        }
+
         if (getClass() != obj.getClass()) {
             return false;
         }
diff --git 
a/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyClient.java
 
b/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyClient.java
index 64b98d2..e030b46 100644
--- 
a/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyClient.java
+++ 
b/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyClient.java
@@ -198,6 +198,10 @@ public class NettyClient extends AbstractClient {
         return NettyChannel.getOrAddChannel(c, getUrl(), this);
     }
 
+    Channel getNettyChannel() {
+        return channel;
+    }
+
     @Override
     public boolean canHandleIdle() {
         return true;

Reply via email to