You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by ic...@apache.org on 2024/05/17 02:48:15 UTC
(dubbo) branch 3.3 updated: Close server channel (#14199)
This is an automated email from the ASF dual-hosted git repository.
icodening pushed a commit to branch 3.3
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/3.3 by this push:
new e8ccb01886 Close server channel (#14199)
e8ccb01886 is described below
commit e8ccb01886ea291de91a18f1a650a2f189bcb162
Author: TomlongTK <lo...@maoyan.com>
AuthorDate: Fri May 17 10:48:09 2024 +0800
Close server channel (#14199)
---
.../remoting/http12/h2/Http2ServerChannelObserver.java | 5 +++++
.../http12/message/LengthFieldStreamingDecoder.java | 13 +++++++++++++
.../dubbo/remoting/http12/message/NoOpStreamingDecoder.java | 5 +++++
.../dubbo/remoting/http12/message/StreamingDecoder.java | 2 ++
.../tri/h12/http2/GenericHttp2ServerTransportListener.java | 2 +-
5 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/dubbo-remoting/dubbo-remoting-http12/src/main/java/org/apache/dubbo/remoting/http12/h2/Http2ServerChannelObserver.java b/dubbo-remoting/dubbo-remoting-http12/src/main/java/org/apache/dubbo/remoting/http12/h2/Http2ServerChannelObserver.java
index 89d77965d6..61568cc5bb 100644
--- a/dubbo-remoting/dubbo-remoting-http12/src/main/java/org/apache/dubbo/remoting/http12/h2/Http2ServerChannelObserver.java
+++ b/dubbo-remoting/dubbo-remoting-http12/src/main/java/org/apache/dubbo/remoting/http12/h2/Http2ServerChannelObserver.java
@@ -119,4 +119,9 @@ public class Http2ServerChannelObserver extends AbstractServerHttpChannelObserve
public boolean isAutoRequestN() {
return autoRequestN;
}
+
+ public void onStreamClosed() {
+ closed = true;
+ streamingDecoder.onStreamClosed();
+ }
}
diff --git a/dubbo-remoting/dubbo-remoting-http12/src/main/java/org/apache/dubbo/remoting/http12/message/LengthFieldStreamingDecoder.java b/dubbo-remoting/dubbo-remoting-http12/src/main/java/org/apache/dubbo/remoting/http12/message/LengthFieldStreamingDecoder.java
index 4e0a087ccd..980ccf2ccf 100644
--- a/dubbo-remoting/dubbo-remoting-http12/src/main/java/org/apache/dubbo/remoting/http12/message/LengthFieldStreamingDecoder.java
+++ b/dubbo-remoting/dubbo-remoting-http12/src/main/java/org/apache/dubbo/remoting/http12/message/LengthFieldStreamingDecoder.java
@@ -84,6 +84,19 @@ public class LengthFieldStreamingDecoder implements StreamingDecoder {
deliver();
}
+ @Override
+ public final void onStreamClosed() {
+ if (closed) {
+ return;
+ }
+ closed = true;
+ try {
+ accumulate.close();
+ } catch (IOException e) {
+ throw new DecodeException(e);
+ }
+ }
+
@Override
public final void setFragmentListener(FragmentListener listener) {
this.listener = listener;
diff --git a/dubbo-remoting/dubbo-remoting-http12/src/main/java/org/apache/dubbo/remoting/http12/message/NoOpStreamingDecoder.java b/dubbo-remoting/dubbo-remoting-http12/src/main/java/org/apache/dubbo/remoting/http12/message/NoOpStreamingDecoder.java
index 60e2909b83..473e6a2ed0 100644
--- a/dubbo-remoting/dubbo-remoting-http12/src/main/java/org/apache/dubbo/remoting/http12/message/NoOpStreamingDecoder.java
+++ b/dubbo-remoting/dubbo-remoting-http12/src/main/java/org/apache/dubbo/remoting/http12/message/NoOpStreamingDecoder.java
@@ -39,6 +39,11 @@ public class NoOpStreamingDecoder implements StreamingDecoder {
this.listener.onClose();
}
+ @Override
+ public void onStreamClosed() {
+ // do nothing
+ }
+
@Override
public void setFragmentListener(FragmentListener listener) {
this.listener = listener;
diff --git a/dubbo-remoting/dubbo-remoting-http12/src/main/java/org/apache/dubbo/remoting/http12/message/StreamingDecoder.java b/dubbo-remoting/dubbo-remoting-http12/src/main/java/org/apache/dubbo/remoting/http12/message/StreamingDecoder.java
index 65d54f221e..5372eea9c0 100644
--- a/dubbo-remoting/dubbo-remoting-http12/src/main/java/org/apache/dubbo/remoting/http12/message/StreamingDecoder.java
+++ b/dubbo-remoting/dubbo-remoting-http12/src/main/java/org/apache/dubbo/remoting/http12/message/StreamingDecoder.java
@@ -28,6 +28,8 @@ public interface StreamingDecoder {
void close();
+ void onStreamClosed();
+
void setFragmentListener(FragmentListener listener);
interface FragmentListener {
diff --git a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/h12/http2/GenericHttp2ServerTransportListener.java b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/h12/http2/GenericHttp2ServerTransportListener.java
index 4821563a09..5be8bfcf68 100644
--- a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/h12/http2/GenericHttp2ServerTransportListener.java
+++ b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/h12/http2/GenericHttp2ServerTransportListener.java
@@ -191,7 +191,7 @@ public class GenericHttp2ServerTransportListener extends AbstractServerTransport
@Override
public void onStreamClosed() {
// doing on event loop thread
- getStreamingDecoder().close();
+ getServerChannelObserver().onStreamClosed();
}
private static class Http2StreamingDecodeListener implements ListeningDecoder.Listener {