1、加打印查基站修改同步问题
This commit is contained in:
parent
371f7a0c6f
commit
d48dbe38a0
@ -41,14 +41,14 @@ public class D331RtcmMessageExecutor implements Executor<D331RtcmMessage, Void>
|
|||||||
// 补齐tenantId
|
// 补齐tenantId
|
||||||
Device device1 = deviceService.findByDeviceId(id);
|
Device device1 = deviceService.findByDeviceId(id);
|
||||||
if(device1 == null || device1.getOpMode() == GnssDevice.OP_MODE_UNUSE) return null;
|
if(device1 == null || device1.getOpMode() == GnssDevice.OP_MODE_UNUSE) return null;
|
||||||
if (logger.isDebugEnabled()) {
|
logger.debug("receive d331 rtcm message of device: "+message.getId()+", seq:"+message.getSeq()+", len:"+message.getLen());
|
||||||
logger.debug("receive d331 rtcm message of device: "+message.getId()+", seq:"+message.getSeq()+", len:"+message.getLen());
|
|
||||||
}
|
|
||||||
// 推送基站数据
|
// 推送基站数据
|
||||||
if(device1.getOpMode() == GnssDevice.OP_MODE_USE) {
|
if(device1.getOpMode() == GnssDevice.OP_MODE_USE) {
|
||||||
byte[] forwardBytes = message.getSrcData();
|
byte[] forwardBytes = message.getSrcData();
|
||||||
// 要求快速转发,因此用缓存,不要每次都查数据库
|
// 要求快速转发,因此用缓存,不要每次都查数据库
|
||||||
List<Device> deviceList = deviceService.findByParentId(id);
|
List<Device> deviceList = deviceService.findByParentId(id);
|
||||||
|
logger.debug("base station {} has {} rovers: "+message.getId(),deviceList.size());
|
||||||
for (Device device : deviceList) {
|
for (Device device : deviceList) {
|
||||||
if (device.getOpMode() != GnssDevice.OP_MODE_USE) continue;
|
if (device.getOpMode() != GnssDevice.OP_MODE_USE) continue;
|
||||||
String deviceId = device.getDeviceId();
|
String deviceId = device.getDeviceId();
|
||||||
|
|||||||
@ -2,6 +2,8 @@ package com.imdroid.sideslope.sal;
|
|||||||
|
|
||||||
import com.google.common.cache.Cache;
|
import com.google.common.cache.Cache;
|
||||||
import com.google.common.cache.CacheBuilder;
|
import com.google.common.cache.CacheBuilder;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
@ -14,13 +16,15 @@ import java.util.concurrent.TimeUnit;
|
|||||||
*/
|
*/
|
||||||
@Component(value = "local")
|
@Component(value = "local")
|
||||||
public class LocalDeviceServiceImpl implements DeviceService {
|
public class LocalDeviceServiceImpl implements DeviceService {
|
||||||
|
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||||
|
|
||||||
/*static RemovalListener<String, Device> removalListener = new RemovalListener<String, Device>() {
|
/*static RemovalListener<String, Device> removalListener = new RemovalListener<String, Device>() {
|
||||||
public void onRemoval(RemovalNotification<String, Device> removal) {
|
public void onRemoval(RemovalNotification<String, Device> removal) {
|
||||||
|
|
||||||
}
|
}
|
||||||
};*/
|
};*/
|
||||||
private static final Cache<String, Device> deviceCache = CacheBuilder.newBuilder().
|
private static final Cache<String, Device> deviceCache = CacheBuilder.newBuilder().
|
||||||
expireAfterAccess(90, TimeUnit.MINUTES).build();
|
expireAfterAccess(20, TimeUnit.MINUTES).build();
|
||||||
|
|
||||||
private static final Cache<String, List<Device>> subDeviceCache = CacheBuilder.newBuilder().
|
private static final Cache<String, List<Device>> subDeviceCache = CacheBuilder.newBuilder().
|
||||||
expireAfterAccess(10, TimeUnit.MINUTES).build();
|
expireAfterAccess(10, TimeUnit.MINUTES).build();
|
||||||
@ -44,6 +48,7 @@ public class LocalDeviceServiceImpl implements DeviceService {
|
|||||||
public List<Device> findByParentId(String parentId) {
|
public List<Device> findByParentId(String parentId) {
|
||||||
List<Device> device = subDeviceCache.getIfPresent(parentId);
|
List<Device> device = subDeviceCache.getIfPresent(parentId);
|
||||||
if (device == null) {
|
if (device == null) {
|
||||||
|
logger.debug("base station {} refresh: "+parentId);
|
||||||
device = delegate.findByParentId(parentId);
|
device = delegate.findByParentId(parentId);
|
||||||
if (device != null) {
|
if (device != null) {
|
||||||
subDeviceCache.put(parentId, device);
|
subDeviceCache.put(parentId, device);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user