Skip to content

Commit

Permalink
#2762: [Dubbo - qos-http] stopServer should be invoked ? (#2768)
Browse files Browse the repository at this point in the history
  • Loading branch information
beiwei30 authored and zonghaishang committed Nov 9, 2018
1 parent 86c4737 commit 7629e73
Showing 1 changed file with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,10 @@ public <T> Invoker<T> refer(Class<T> type, URL url) throws RpcException {
@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) {
Expand All @@ -90,6 +87,10 @@ private void startQosServer(URL url) {
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();
Expand All @@ -101,4 +102,11 @@ private void startQosServer(URL url) {
logger.warn("Fail to start qos server: ", throwable);
}
}

/*package*/ void stopServer() {
if (hasStarted.compareAndSet(true, false)) {
Server server = Server.getInstance();
server.stop();
}
}
}

0 comments on commit 7629e73

Please sign in to comment.