mirror of
https://gitee.com/wujiawei1207537021/wu-lazy-cloud-network.git
synced 2025-06-17 02:45:03 +08:00
[fix] 修复数据存乎导致主线程问题
This commit is contained in:
@ -37,37 +37,42 @@ public class NettyClientSocketApplicationListener implements ApplicationListener
|
||||
*/
|
||||
public void initDb2Config() {
|
||||
|
||||
String clientId = nettyClientProperties.getClientId();
|
||||
String inetHost = nettyClientProperties.getInetHost();
|
||||
int inetPort = nettyClientProperties.getInetPort();
|
||||
String appKey = nettyClientProperties.getAppKey();
|
||||
String appSecret = nettyClientProperties.getAppSecret();
|
||||
ProtocolType protocolType = nettyClientProperties.getProtocolType();
|
||||
if (Objects.isNull(clientId) ||
|
||||
Objects.isNull(inetHost)) {
|
||||
log.warn("配置信息为空,请通过页面添加配置信息:{}", nettyClientProperties);
|
||||
return;
|
||||
}
|
||||
LazyNettyServerPropertiesDO lazyNettyServerPropertiesDO = new LazyNettyServerPropertiesDO();
|
||||
lazyNettyServerPropertiesDO.setClientId(clientId);
|
||||
lazyNettyServerPropertiesDO.setInetHost(inetHost);
|
||||
lazyNettyServerPropertiesDO.setInetPort(inetPort);
|
||||
lazyNettyServerPropertiesDO.setType(PropertiesType.CONFIG);
|
||||
lazyNettyServerPropertiesDO.setIsDeleted(false);
|
||||
lazyNettyServerPropertiesDO.setAppKey(appKey);
|
||||
lazyNettyServerPropertiesDO.setAppSecret(appSecret);
|
||||
lazyNettyServerPropertiesDO.setProtocolType(protocolType);
|
||||
try {
|
||||
String clientId = nettyClientProperties.getClientId();
|
||||
String inetHost = nettyClientProperties.getInetHost();
|
||||
int inetPort = nettyClientProperties.getInetPort();
|
||||
String appKey = nettyClientProperties.getAppKey();
|
||||
String appSecret = nettyClientProperties.getAppSecret();
|
||||
ProtocolType protocolType = nettyClientProperties.getProtocolType();
|
||||
if (Objects.isNull(clientId) ||
|
||||
Objects.isNull(inetHost)) {
|
||||
log.warn("配置信息为空,请通过页面添加配置信息:{}", nettyClientProperties);
|
||||
return;
|
||||
}
|
||||
LazyNettyServerPropertiesDO lazyNettyServerPropertiesDO = new LazyNettyServerPropertiesDO();
|
||||
lazyNettyServerPropertiesDO.setClientId(clientId);
|
||||
lazyNettyServerPropertiesDO.setInetHost(inetHost);
|
||||
lazyNettyServerPropertiesDO.setInetPort(inetPort);
|
||||
lazyNettyServerPropertiesDO.setType(PropertiesType.CONFIG);
|
||||
lazyNettyServerPropertiesDO.setIsDeleted(false);
|
||||
lazyNettyServerPropertiesDO.setAppKey(appKey);
|
||||
lazyNettyServerPropertiesDO.setAppSecret(appSecret);
|
||||
lazyNettyServerPropertiesDO.setProtocolType(protocolType);
|
||||
|
||||
// 根据服务端端口、port 唯一性验证
|
||||
boolean exists = lazyLambdaStream.exists(LazyWrappers.<LazyNettyServerPropertiesDO>lambdaWrapper()
|
||||
.eq(LazyNettyServerPropertiesDO::getInetHost, inetHost)
|
||||
.eq(LazyNettyServerPropertiesDO::getInetPort, inetPort)
|
||||
.eq(LazyNettyServerPropertiesDO::getClientId, clientId)
|
||||
.eq(LazyNettyServerPropertiesDO::getProtocolType, protocolType)
|
||||
);
|
||||
if (!exists) {
|
||||
lazyLambdaStream.insert(lazyNettyServerPropertiesDO);
|
||||
}
|
||||
|
||||
// 根据服务端端口、port 唯一性验证
|
||||
boolean exists = lazyLambdaStream.exists(LazyWrappers.<LazyNettyServerPropertiesDO>lambdaWrapper()
|
||||
.eq(LazyNettyServerPropertiesDO::getInetHost, inetHost)
|
||||
.eq(LazyNettyServerPropertiesDO::getInetPort, inetPort)
|
||||
.eq(LazyNettyServerPropertiesDO::getClientId, clientId)
|
||||
.eq(LazyNettyServerPropertiesDO::getProtocolType, protocolType)
|
||||
);
|
||||
if (!exists) {
|
||||
lazyLambdaStream.insert(lazyNettyServerPropertiesDO);
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user