Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
java胎教生
mica-mqtt
提交
21a87faf
mica-mqtt
项目概览
java胎教生
/
mica-mqtt
与 Fork 源项目一致
Fork自
mica / mica-mqtt
通知
5
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
mica-mqtt
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
21a87faf
编写于
7月 28, 2021
作者:
如梦技术
🐛
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
✨
代码优化。
上级
ae4bdd62
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
11 addition
and
26 deletion
+11
-26
mica-mqtt-codec/src/main/java/net/dreamlu/iot/mqtt/codec/MqttCodecUtil.java
...c/main/java/net/dreamlu/iot/mqtt/codec/MqttCodecUtil.java
+1
-0
mica-mqtt-codec/src/main/java/net/dreamlu/iot/mqtt/codec/MqttConstant.java
...rc/main/java/net/dreamlu/iot/mqtt/codec/MqttConstant.java
+3
-3
mica-mqtt-codec/src/main/java/net/dreamlu/iot/mqtt/codec/MqttEncoder.java
...src/main/java/net/dreamlu/iot/mqtt/codec/MqttEncoder.java
+1
-0
mica-mqtt-core/src/main/java/net/dreamlu/iot/mqtt/core/client/MqttClientAioHandler.java
...et/dreamlu/iot/mqtt/core/client/MqttClientAioHandler.java
+0
-1
mica-mqtt-core/src/main/java/net/dreamlu/iot/mqtt/core/client/MqttClientCreator.java
...a/net/dreamlu/iot/mqtt/core/client/MqttClientCreator.java
+4
-2
mica-mqtt-core/src/main/java/net/dreamlu/iot/mqtt/core/server/MqttServerAioHandler.java
...et/dreamlu/iot/mqtt/core/server/MqttServerAioHandler.java
+1
-3
mica-mqtt-core/src/main/java/net/dreamlu/iot/mqtt/core/server/MqttServerCreator.java
...a/net/dreamlu/iot/mqtt/core/server/MqttServerCreator.java
+1
-17
未找到文件。
mica-mqtt-codec/src/main/java/net/dreamlu/iot/mqtt/codec/MqttCodecUtil.java
浏览文件 @
21a87faf
...
...
@@ -17,6 +17,7 @@
package
net.dreamlu.iot.mqtt.codec
;
import
org.tio.core.ChannelContext
;
import
static
net
.
dreamlu
.
iot
.
mqtt
.
codec
.
MqttConstant
.
MIN_CLIENT_ID_LENGTH
;
/**
...
...
mica-mqtt-codec/src/main/java/net/dreamlu/iot/mqtt/codec/MqttConstant.java
浏览文件 @
21a87faf
...
...
@@ -23,9 +23,6 @@ package net.dreamlu.iot.mqtt.codec;
*/
public
final
class
MqttConstant
{
private
MqttConstant
()
{
}
/**
* mqtt protocol length
*/
...
...
@@ -47,4 +44,7 @@ public final class MqttConstant {
*/
public
static
final
int
DEFAULT_MAX_CLIENT_ID_LENGTH
=
23
;
private
MqttConstant
()
{
}
}
mica-mqtt-codec/src/main/java/net/dreamlu/iot/mqtt/codec/MqttEncoder.java
浏览文件 @
21a87faf
...
...
@@ -21,6 +21,7 @@ import org.tio.core.ChannelContext;
import
java.nio.ByteBuffer
;
import
java.nio.charset.StandardCharsets
;
import
java.util.List
;
import
static
net
.
dreamlu
.
iot
.
mqtt
.
codec
.
MqttConstant
.
DEFAULT_MAX_CLIENT_ID_LENGTH
;
/**
...
...
mica-mqtt-core/src/main/java/net/dreamlu/iot/mqtt/core/client/MqttClientAioHandler.java
浏览文件 @
21a87faf
...
...
@@ -20,7 +20,6 @@ import net.dreamlu.iot.mqtt.codec.*;
import
org.tio.client.intf.ClientAioHandler
;
import
org.tio.core.ChannelContext
;
import
org.tio.core.TioConfig
;
import
org.tio.core.exception.TioDecodeException
;
import
org.tio.core.intf.Packet
;
import
java.nio.ByteBuffer
;
...
...
mica-mqtt-core/src/main/java/net/dreamlu/iot/mqtt/core/client/MqttClientCreator.java
浏览文件 @
21a87faf
...
...
@@ -16,7 +16,10 @@
package
net.dreamlu.iot.mqtt.core.client
;
import
net.dreamlu.iot.mqtt.codec.*
;
import
net.dreamlu.iot.mqtt.codec.ByteBufferAllocator
;
import
net.dreamlu.iot.mqtt.codec.MqttConstant
;
import
net.dreamlu.iot.mqtt.codec.MqttProperties
;
import
net.dreamlu.iot.mqtt.codec.MqttVersion
;
import
org.tio.client.ClientChannelContext
;
import
org.tio.client.ClientTioConfig
;
import
org.tio.client.ReconnConf
;
...
...
@@ -28,7 +31,6 @@ import org.tio.core.ssl.SslConfig;
import
org.tio.utils.hutool.StrUtil
;
import
org.tio.utils.thread.pool.DefaultThreadFactory
;
import
java.util.Objects
;
import
java.util.concurrent.CountDownLatch
;
import
java.util.concurrent.ScheduledThreadPoolExecutor
;
import
java.util.function.Consumer
;
...
...
mica-mqtt-core/src/main/java/net/dreamlu/iot/mqtt/core/server/MqttServerAioHandler.java
浏览文件 @
21a87faf
...
...
@@ -22,7 +22,6 @@ import org.slf4j.LoggerFactory;
import
org.tio.core.ChannelContext
;
import
org.tio.core.Tio
;
import
org.tio.core.TioConfig
;
import
org.tio.core.exception.TioDecodeException
;
import
org.tio.core.intf.Packet
;
import
org.tio.server.AcceptCompletionHandler
;
import
org.tio.server.intf.ServerAioHandler
;
...
...
@@ -41,10 +40,9 @@ public class MqttServerAioHandler implements ServerAioHandler {
private
final
MqttServerProcessor
processor
;
public
MqttServerAioHandler
(
int
maxBytesInMessage
,
int
maxClientIdLength
,
ByteBufferAllocator
bufferAllocator
,
MqttServerProcessor
processor
)
{
this
.
mqttDecoder
=
new
MqttDecoder
(
maxBytesInMessage
,
maxClientIdLength
);
this
.
mqttDecoder
=
new
MqttDecoder
(
maxBytesInMessage
);
this
.
mqttEncoder
=
MqttEncoder
.
INSTANCE
;
this
.
allocator
=
bufferAllocator
;
this
.
processor
=
processor
;
...
...
mica-mqtt-core/src/main/java/net/dreamlu/iot/mqtt/core/server/MqttServerCreator.java
浏览文件 @
21a87faf
...
...
@@ -70,10 +70,6 @@ public class MqttServerCreator {
* 消息解析最大 bytes 长度,默认:8092
*/
private
int
maxBytesInMessage
=
MqttConstant
.
DEFAULT_MAX_BYTES_IN_MESSAGE
;
/**
* 最大 clientId 长度,默认:23
*/
private
int
maxClientIdLength
=
MqttConstant
.
DEFAULT_MAX_CLIENT_ID_LENGTH
;
/**
* 堆内存和堆外内存
*/
...
...
@@ -176,18 +172,6 @@ public class MqttServerCreator {
return
this
;
}
public
int
getMaxClientIdLength
()
{
return
maxClientIdLength
;
}
public
MqttServerCreator
maxClientIdLength
(
int
maxClientIdLength
)
{
if
(
maxClientIdLength
<
1
)
{
throw
new
IllegalArgumentException
(
"maxClientIdLength must be greater than 0."
);
}
this
.
maxClientIdLength
=
maxClientIdLength
;
return
this
;
}
public
ByteBufferAllocator
getBufferAllocator
()
{
return
bufferAllocator
;
}
...
...
@@ -324,7 +308,7 @@ public class MqttServerCreator {
DefaultMqttServerProcessor
serverProcessor
=
new
DefaultMqttServerProcessor
(
this
.
messageStore
,
this
.
sessionManager
,
this
.
authHandler
,
this
.
subscribeManager
,
this
.
messageDispatcher
,
this
.
connectStatusListener
,
this
.
messageListener
,
executor
);
// 1. 处理消息
ServerAioHandler
handler
=
new
MqttServerAioHandler
(
this
.
maxBytesInMessage
,
this
.
maxClientIdLength
,
this
.
bufferAllocator
,
serverProcessor
);
ServerAioHandler
handler
=
new
MqttServerAioHandler
(
this
.
maxBytesInMessage
,
this
.
bufferAllocator
,
serverProcessor
);
// 2. t-io 监听
ServerAioListener
listener
=
new
MqttServerAioListener
(
this
.
messageStore
,
this
.
sessionManager
,
this
.
subscribeManager
,
this
.
messageDispatcher
,
this
.
connectStatusListener
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录