From 6bc36eaa41153b734a1615312ba5a47144b354ee Mon Sep 17 00:00:00 2001 From: lizhen Date: Wed, 30 Jan 2019 15:47:18 +0800 Subject: [PATCH 1/2] fix when qos is disable,log will print every time. --- .../dubbo/qos/protocol/QosProtocolWrapper.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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); From c722c5c8ed11d9916f665f5e4244749b945803a7 Mon Sep 17 00:00:00 2001 From: lizhen Date: Wed, 30 Jan 2019 18:03:53 +0800 Subject: [PATCH 2/2] change qos server boos thread number 1 --- .../src/main/java/org/apache/dubbo/qos/server/Server.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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);