1、修改mqtt的bug

This commit is contained in:
weidong 2024-01-26 10:48:13 +08:00
parent 2132f0b4ad
commit 6961ad49ea
6 changed files with 12 additions and 15 deletions

View File

@ -33,7 +33,7 @@ public class GZYForwarder extends Forwarder{
@PostConstruct @PostConstruct
void registerMe(){ void registerMe(){
init(FORWARDER_NAME, host+":"+port,2,true); init(FORWARDER_NAME, "UDP "+host+":"+port,2,true);
udpClient = new UDPClient(); udpClient = new UDPClient();
udpClient.init(host, port); udpClient.init(host, port);
} }

View File

@ -24,7 +24,7 @@ import java.util.List;
public class GZYMQTTForwarder extends Forwarder { public class GZYMQTTForwarder extends Forwarder {
private final Logger logger = LoggerFactory.getLogger(GZYMQTTForwarder.class); private final Logger logger = LoggerFactory.getLogger(GZYMQTTForwarder.class);
static final String FORWARDER_NAME = "贵州交勘院"; static final String FORWARDER_NAME = "贵州交勘院MQTT";
@Value("${mqtt.server.brokerUrl}") @Value("${mqtt.server.brokerUrl}")
private String brokerUrl; private String brokerUrl;
@Value("${mqtt.server.username}") @Value("${mqtt.server.username}")

View File

@ -1,5 +1,6 @@
package com.imdroid.sideslope.calc; package com.imdroid.sideslope.calc;
import com.imdroid.common.util.ThreadManager;
import com.imdroid.secapi.dto.GnssCalcData; import com.imdroid.secapi.dto.GnssCalcData;
import com.imdroid.sideslope.bd.*; import com.imdroid.sideslope.bd.*;
import com.imdroid.sideslope.message.D341LocationMessage; import com.imdroid.sideslope.message.D341LocationMessage;
@ -34,8 +35,6 @@ public class SingleLineGNSSCalcService implements GNSSDataCalcService {
private static final Map<String, Boolean> cleanPositionStatusMap = new ConcurrentHashMap<>(); private static final Map<String, Boolean> cleanPositionStatusMap = new ConcurrentHashMap<>();
private static final ScheduledExecutorService executorService = Executors.newScheduledThreadPool(4);
@Autowired @Autowired
WarningService warningService; WarningService warningService;
@ -72,7 +71,7 @@ public class SingleLineGNSSCalcService implements GNSSDataCalcService {
@Override @Override
public void calSingleDone(String deviceId, Integer tenantId, LocalDateTime resultTime) { public void calSingleDone(String deviceId, Integer tenantId, LocalDateTime resultTime) {
executorService.schedule(() -> { ThreadManager.getScheduledThreadPool().schedule(() -> {
try { try {
calCycleResult(deviceId, tenantId, resultTime); calCycleResult(deviceId, tenantId, resultTime);
} catch (Exception e) { } catch (Exception e) {
@ -90,7 +89,7 @@ public class SingleLineGNSSCalcService implements GNSSDataCalcService {
future = null; future = null;
} }
future = executorService.schedule(() -> { future = ThreadManager.getScheduledThreadPool().schedule(() -> {
try { try {
calCycleResult(deviceId, tenantId, date); calCycleResult(deviceId, tenantId, date);
} catch (Exception e) { } catch (Exception e) {

View File

@ -53,8 +53,6 @@ public class D3F0SelfCheckMessageExecutor implements Executor<D3F0SelfCheckMessa
dataPersistService.saveDeviceState(message); dataPersistService.saveDeviceState(message);
}); });
return null; return null;
} }

View File

@ -55,13 +55,13 @@ public class D3F2StopIndicationMessageExecutor implements Executor<D3F2StopIndic
// 储设备收发字节数统计信息 // 储设备收发字节数统计信息
ThreadManager.getFixedThreadPool().submit(() -> { ThreadManager.getFixedThreadPool().submit(() -> {
dataPersistService.saveDeviceTrxStat(message, (uploadTime!=null)); dataPersistService.saveDeviceTrxStat(message, (uploadTime!=null));
// 通知beidou服务设备休眠
beidouClient.onDeviceStop(deviceId,device.getTenantId());
if(uploadTime!=null){
beidouClient.onGnssUpload(deviceId,device.getTenantId(),uploadTime);
}
}); });
// 通知beidou服务设备休眠
beidouClient.onDeviceStop(deviceId,device.getTenantId());
if(uploadTime!=null){
beidouClient.onGnssUpload(deviceId,device.getTenantId(),uploadTime);
}
return null; return null;
} }

View File

@ -14,7 +14,7 @@ public class ThreadManager {
private static final class FixedThreadPoolHolder { private static final class FixedThreadPoolHolder {
//固定线程池 //固定线程池
static final ExecutorService fixedThreadPool = Executors.newFixedThreadPool(3); static final ExecutorService fixedThreadPool = Executors.newFixedThreadPool(10);
} }
public static ExecutorService getFixedThreadPool() { public static ExecutorService getFixedThreadPool() {
@ -23,7 +23,7 @@ public class ThreadManager {
private static final class ScheduledThreadPoolHolder { private static final class ScheduledThreadPoolHolder {
//定时线程池 //定时线程池
static final ScheduledExecutorService scheduledThreadPool = Executors.newScheduledThreadPool(4); static final ScheduledExecutorService scheduledThreadPool = Executors.newScheduledThreadPool(10);
} }
public static ScheduledExecutorService getScheduledThreadPool() { public static ScheduledExecutorService getScheduledThreadPool() {