This is an automated email from the ASF dual-hosted git repository.
yiji pushed a commit to branch 2.6.x
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git
The following commit(s) were added to refs/heads/2.6.x by this push:
new 7629e73 #2762: [Dubbo - qos-http] stopServer should be invoked ?
(#2768)
7629e73 is described below
commit 7629e7309096d7d5509ba683ec31590b9b8acecc
Author: Ian Luo <[email protected]>
AuthorDate: Fri Nov 9 18:41:20 2018 +0800
#2762: [Dubbo - qos-http] stopServer should be invoked ? (#2768)
---
.../alibaba/dubbo/qos/protocol/QosProtocolWrapper.java | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git
a/dubbo-plugin/dubbo-qos/src/main/java/com/alibaba/dubbo/qos/protocol/QosProtocolWrapper.java
b/dubbo-plugin/dubbo-qos/src/main/java/com/alibaba/dubbo/qos/protocol/QosProtocolWrapper.java
index 73d1f56..e7a8ff6 100644
---
a/dubbo-plugin/dubbo-qos/src/main/java/com/alibaba/dubbo/qos/protocol/QosProtocolWrapper.java
+++
b/dubbo-plugin/dubbo-qos/src/main/java/com/alibaba/dubbo/qos/protocol/QosProtocolWrapper.java
@@ -74,13 +74,10 @@ public class QosProtocolWrapper implements Protocol {
@Override
public void destroy() {
protocol.destroy();
+ stopServer();
}
private void startQosServer(URL url) {
- if (!hasStarted.compareAndSet(false, true)) {
- return;
- }
-
try {
boolean qosEnable = url.getParameter(QOS_ENABLE,true);
if (!qosEnable) {
@@ -90,6 +87,10 @@ public class QosProtocolWrapper implements Protocol {
return;
}
+ if (!hasStarted.compareAndSet(false, true)) {
+ return;
+ }
+
int port = url.getParameter(QOS_PORT, DEFAULT_PORT);
boolean acceptForeignIp =
Boolean.parseBoolean(url.getParameter(ACCEPT_FOREIGN_IP,"false"));
Server server = com.alibaba.dubbo.qos.server.Server.getInstance();
@@ -101,4 +102,11 @@ public class QosProtocolWrapper implements Protocol {
logger.warn("Fail to start qos server: ", throwable);
}
}
+
+ /*package*/ void stopServer() {
+ if (hasStarted.compareAndSet(true, false)) {
+ Server server = Server.getInstance();
+ server.stop();
+ }
+ }
}