提交 39bb58ee 编写于 作者: 浅梦2013's avatar 浅梦2013

低版本兼容。

上级 ebc9fd81
......@@ -49,9 +49,9 @@ public final class MqttServer {
private final ScheduledThreadPoolExecutor executor;
MqttServer(TioServer tioServer,
MqttWebServer webServer,
MqttServerCreator serverCreator,
ScheduledThreadPoolExecutor executor) {
MqttWebServer webServer,
MqttServerCreator serverCreator,
ScheduledThreadPoolExecutor executor) {
this.tioServer = tioServer;
this.webServer = webServer;
this.serverCreator = serverCreator;
......@@ -244,7 +244,7 @@ public final class MqttServer {
return true;
}
public MqttServer start() {
public boolean start() {
// 1. 启动 mqtt tcp
try {
tioServer.start(this.serverCreator.getIp(), this.serverCreator.getPort());
......@@ -259,7 +259,7 @@ public final class MqttServer {
throw new IllegalStateException("Mica mqtt http/websocket server start fail.", e);
}
}
return this;
return true;
}
public boolean stop() {
......
......@@ -413,4 +413,9 @@ public class MqttServerCreator {
return mqttServer;
}
public MqttServer start() {
MqttServer mqttServer = this.build();
mqttServer.start();
return mqttServer;
}
}
......@@ -55,7 +55,6 @@ public class Server {
.messageDispatcher(messageDispatcher)
.messageListener(messageListener)
.debug()
.build()
.start();
}
}
......@@ -50,7 +50,6 @@ public class MqttServerTest {
logger.info("clientId:{} topic:{} mqttQoS:{} message:{}", clientId, topic, mqttQoS, ByteBufferUtil.toString(payload));
})
.debug() // 开启 debug 信息日志
.build()
.start();
Timer timer = new Timer();
......
......@@ -49,7 +49,6 @@ public class MqttServerTest {
logger.info("clientId:{} topic:{} mqttQoS:{} message:{}", clientId, topic, mqttQoS, ByteBufferUtil.toString(payload));
})
.debug() // 开启 debug 信息日志
.build()
.start();
Timer timer = new Timer();
......
......@@ -35,8 +35,7 @@ public class MqttServerLauncher implements SmartLifecycle, Ordered {
@Override
public void start() {
mqttServer.start();
running = true;
running = mqttServer.start();
}
@Override
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册