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 2023/03/16 01:45:02 UTC
[dubbo] branch 3.2 updated: 1. Fix HeaderExchangeChannel close potential bug (#11834)
This is an automated email from the ASF dual-hosted git repository.
albumenj pushed a commit to branch 3.2
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/3.2 by this push:
new c8e7ef7892 1. Fix HeaderExchangeChannel close potential bug (#11834)
c8e7ef7892 is described below
commit c8e7ef7892bcead49f4b783c7d56afb5c145b9d2
Author: Mengyang Tang <me...@163.com>
AuthorDate: Thu Mar 16 09:44:53 2023 +0800
1. Fix HeaderExchangeChannel close potential bug (#11834)
2. 'channel != null' must be satisfied, simplify hashCode and equals
---
.../exchange/support/header/HeaderExchangeChannel.java | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/support/header/HeaderExchangeChannel.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/support/header/HeaderExchangeChannel.java
index ab576db76a..6c4e7fd09c 100644
--- a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/support/header/HeaderExchangeChannel.java
+++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/support/header/HeaderExchangeChannel.java
@@ -160,6 +160,11 @@ final class HeaderExchangeChannel implements ExchangeChannel {
try {
// graceful close
DefaultFuture.closeChannel(channel);
+ } catch (Exception e) {
+ logger.warn(TRANSPORT_FAILED_CLOSE, "", "", e.getMessage(), e);
+ }
+
+ try {
channel.close();
} catch (Exception e) {
logger.warn(TRANSPORT_FAILED_CLOSE, "", "", e.getMessage(), e);
@@ -245,7 +250,7 @@ final class HeaderExchangeChannel implements ExchangeChannel {
public int hashCode() {
final int prime = 31;
int result = 1;
- result = prime * result + ((channel == null) ? 0 : channel.hashCode());
+ result = prime * result + channel.hashCode();
return result;
}
@@ -261,14 +266,7 @@ final class HeaderExchangeChannel implements ExchangeChannel {
return false;
}
HeaderExchangeChannel other = (HeaderExchangeChannel) obj;
- if (channel == null) {
- if (other.channel != null) {
- return false;
- }
- } else if (!channel.equals(other.channel)) {
- return false;
- }
- return true;
+ return channel.equals(other.channel);
}
@Override