diff --git a/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/protocol/QosProtocolWrapper.java b/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/protocol/QosProtocolWrapper.java index 6c2fbaed91e..ae0b22eeeed 100644 --- a/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/protocol/QosProtocolWrapper.java +++ b/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/protocol/QosProtocolWrapper.java @@ -80,7 +80,11 @@ public void destroy() { private void startQosServer(URL url) { try { - boolean qosEnable = url.getParameter(QOS_ENABLE,true); + if (!hasStarted.compareAndSet(false, true)) { + return; + } + + boolean qosEnable = url.getParameter(QOS_ENABLE, true); if (!qosEnable) { logger.info("qos won't be started because it is disabled. " + "Please check dubbo.application.qos.enable is configured either in system property, " + @@ -88,12 +92,8 @@ private void startQosServer(URL url) { return; } - if (!hasStarted.compareAndSet(false, true)) { - return; - } - int port = url.getParameter(QOS_PORT, QosConstants.DEFAULT_PORT); - boolean acceptForeignIp = Boolean.parseBoolean(url.getParameter(ACCEPT_FOREIGN_IP,"false")); + boolean acceptForeignIp = Boolean.parseBoolean(url.getParameter(ACCEPT_FOREIGN_IP, "false")); Server server = Server.getInstance(); server.setPort(port); server.setAcceptForeignIp(acceptForeignIp); diff --git a/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/server/Server.java b/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/server/Server.java index b39221dcbf8..53bbc81493a 100644 --- a/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/server/Server.java +++ b/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/server/Server.java @@ -82,7 +82,7 @@ public void start() throws Throwable { if (!started.compareAndSet(false, true)) { return; } - boss = new NioEventLoopGroup(0, new DefaultThreadFactory("qos-boss", true)); + boss = new NioEventLoopGroup(1, new DefaultThreadFactory("qos-boss", true)); worker = new NioEventLoopGroup(0, new DefaultThreadFactory("qos-worker", true)); ServerBootstrap serverBootstrap = new ServerBootstrap(); serverBootstrap.group(boss, worker);