You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by yi...@apache.org on 2019/03/12 10:46:50 UTC
[incubator-dubbo] branch master updated: Fix when qos is disable,
log will print every time. (#3397)
This is an automated email from the ASF dual-hosted git repository.
yiji pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git
The following commit(s) were added to refs/heads/master by this push:
new 9ee2f23 Fix when qos is disable,log will print every time. (#3397)
9ee2f23 is described below
commit 9ee2f230361a9bdbd5044d925fc856c5190c2e4b
Author: LiZhen <Li...@users.noreply.github.com>
AuthorDate: Tue Mar 12 18:46:40 2019 +0800
Fix when qos is disable,log will print every time. (#3397)
* fix when qos is disable,log will print every time.
* change qos server boos thread number 1
---
.../org/apache/dubbo/qos/protocol/QosProtocolWrapper.java | 12 ++++++------
.../src/main/java/org/apache/dubbo/qos/server/Server.java | 2 +-
2 files changed, 7 insertions(+), 7 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 6c2fbae..ae0b22e 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 class QosProtocolWrapper implements Protocol {
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 @@ public class QosProtocolWrapper implements Protocol {
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 b39221d..53bbc81 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 class Server {
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);