Skip to content

Commit 9ee2f23

Browse files
LiZhenNetzonghaishang
authored andcommitted
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
1 parent dc04701 commit 9ee2f23

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/protocol/QosProtocolWrapper.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,20 +80,20 @@ public void destroy() {
8080

8181
private void startQosServer(URL url) {
8282
try {
83-
boolean qosEnable = url.getParameter(QOS_ENABLE,true);
83+
if (!hasStarted.compareAndSet(false, true)) {
84+
return;
85+
}
86+
87+
boolean qosEnable = url.getParameter(QOS_ENABLE, true);
8488
if (!qosEnable) {
8589
logger.info("qos won't be started because it is disabled. " +
8690
"Please check dubbo.application.qos.enable is configured either in system property, " +
8791
"dubbo.properties or XML/spring-boot configuration.");
8892
return;
8993
}
9094

91-
if (!hasStarted.compareAndSet(false, true)) {
92-
return;
93-
}
94-
9595
int port = url.getParameter(QOS_PORT, QosConstants.DEFAULT_PORT);
96-
boolean acceptForeignIp = Boolean.parseBoolean(url.getParameter(ACCEPT_FOREIGN_IP,"false"));
96+
boolean acceptForeignIp = Boolean.parseBoolean(url.getParameter(ACCEPT_FOREIGN_IP, "false"));
9797
Server server = Server.getInstance();
9898
server.setPort(port);
9999
server.setAcceptForeignIp(acceptForeignIp);

dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/server/Server.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public void start() throws Throwable {
8282
if (!started.compareAndSet(false, true)) {
8383
return;
8484
}
85-
boss = new NioEventLoopGroup(0, new DefaultThreadFactory("qos-boss", true));
85+
boss = new NioEventLoopGroup(1, new DefaultThreadFactory("qos-boss", true));
8686
worker = new NioEventLoopGroup(0, new DefaultThreadFactory("qos-worker", true));
8787
ServerBootstrap serverBootstrap = new ServerBootstrap();
8888
serverBootstrap.group(boss, worker);

0 commit comments

Comments
 (0)