Skip to content

Commit 7629e73

Browse files
beiwei30zonghaishang
authored andcommitted
#2762: [Dubbo - qos-http] stopServer should be invoked ? (#2768)
1 parent 86c4737 commit 7629e73

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

dubbo-plugin/dubbo-qos/src/main/java/com/alibaba/dubbo/qos/protocol/QosProtocolWrapper.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,10 @@ public <T> Invoker<T> refer(Class<T> type, URL url) throws RpcException {
7474
@Override
7575
public void destroy() {
7676
protocol.destroy();
77+
stopServer();
7778
}
7879

7980
private void startQosServer(URL url) {
80-
if (!hasStarted.compareAndSet(false, true)) {
81-
return;
82-
}
83-
8481
try {
8582
boolean qosEnable = url.getParameter(QOS_ENABLE,true);
8683
if (!qosEnable) {
@@ -90,6 +87,10 @@ private void startQosServer(URL url) {
9087
return;
9188
}
9289

90+
if (!hasStarted.compareAndSet(false, true)) {
91+
return;
92+
}
93+
9394
int port = url.getParameter(QOS_PORT, DEFAULT_PORT);
9495
boolean acceptForeignIp = Boolean.parseBoolean(url.getParameter(ACCEPT_FOREIGN_IP,"false"));
9596
Server server = com.alibaba.dubbo.qos.server.Server.getInstance();
@@ -101,4 +102,11 @@ private void startQosServer(URL url) {
101102
logger.warn("Fail to start qos server: ", throwable);
102103
}
103104
}
105+
106+
/*package*/ void stopServer() {
107+
if (hasStarted.compareAndSet(true, false)) {
108+
Server server = Server.getInstance();
109+
server.stop();
110+
}
111+
}
104112
}

0 commit comments

Comments
 (0)