You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by cr...@apache.org on 2021/09/26 03:43:19 UTC
[dubbo] branch 3.0 updated: add destroy() calling to close tomcat
server port (#8920)
This is an automated email from the ASF dual-hosted git repository.
crazyhzm pushed a commit to branch 3.0
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/3.0 by this push:
new bba0a76 add destroy() calling to close tomcat server port (#8920)
bba0a76 is described below
commit bba0a7613672791df341b41b3ab3e9eb135326cb
Author: zrlw <zr...@sina.com>
AuthorDate: Sun Sep 26 11:42:14 2021 +0800
add destroy() calling to close tomcat server port (#8920)
---
.../java/org/apache/dubbo/remoting/http/tomcat/TomcatHttpServer.java | 2 ++
.../org/apache/dubbo/remoting/http/tomcat/TomcatHttpBinderTest.java | 1 +
2 files changed, 3 insertions(+)
diff --git a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/tomcat/TomcatHttpServer.java b/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/tomcat/TomcatHttpServer.java
index 0711590..2d0b8a1 100755
--- a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/tomcat/TomcatHttpServer.java
+++ b/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/tomcat/TomcatHttpServer.java
@@ -88,6 +88,8 @@ public class TomcatHttpServer extends AbstractHttpServer {
try {
tomcat.stop();
+ // close port by destroy()
+ tomcat.destroy();
} catch (Exception e) {
logger.warn(e.getMessage(), e);
}
diff --git a/dubbo-remoting/dubbo-remoting-http/src/test/java/org/apache/dubbo/remoting/http/tomcat/TomcatHttpBinderTest.java b/dubbo-remoting/dubbo-remoting-http/src/test/java/org/apache/dubbo/remoting/http/tomcat/TomcatHttpBinderTest.java
index 8c815b9..25058b1 100644
--- a/dubbo-remoting/dubbo-remoting-http/src/test/java/org/apache/dubbo/remoting/http/tomcat/TomcatHttpBinderTest.java
+++ b/dubbo-remoting/dubbo-remoting-http/src/test/java/org/apache/dubbo/remoting/http/tomcat/TomcatHttpBinderTest.java
@@ -52,5 +52,6 @@ public class TomcatHttpBinderTest {
assertThat(response, is("Tomcat"));
httpServer.close();
+ assertThat(NetUtils.isPortInUsed(port), is(false));
}
}