alarm模块配置文件增加引入armd-analysis-对应的yaml文件
Docker无法获取设备的最大核心数问题,配置文件增加新的配置字段maximum 人工交互,web模块引用C++算法库依赖修改加载方式
This commit is contained in:
parent
9de7d91447
commit
a4568a528e
|
@ -0,0 +1,14 @@
|
||||||
|
package org.jeecg.common.properties;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Component
|
||||||
|
@ConfigurationProperties(prefix = "maximum")
|
||||||
|
public class MaximumPoolSizeProperties {
|
||||||
|
|
||||||
|
private Integer station;
|
||||||
|
|
||||||
|
}
|
|
@ -4,8 +4,10 @@ import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import org.jeecg.common.constant.RedisConstant;
|
import org.jeecg.common.constant.RedisConstant;
|
||||||
import org.jeecg.common.exception.StreamErrorHandler;
|
import org.jeecg.common.exception.StreamErrorHandler;
|
||||||
|
import org.jeecg.common.properties.MaximumPoolSizeProperties;
|
||||||
import org.jeecg.common.util.RedisStreamUtil;
|
import org.jeecg.common.util.RedisStreamUtil;
|
||||||
import org.jeecg.modules.base.dto.Info;
|
import org.jeecg.modules.base.dto.Info;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||||
|
@ -46,6 +48,9 @@ public class RedisStreamConfig {
|
||||||
@Resource
|
@Resource
|
||||||
private RedisStreamUtil redisStreamUtil;
|
private RedisStreamUtil redisStreamUtil;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MaximumPoolSizeProperties maximumPoolSizeProperties;
|
||||||
|
|
||||||
@Bean(initMethod = "start", destroyMethod = "stop")
|
@Bean(initMethod = "start", destroyMethod = "stop")
|
||||||
public StreamMessageListenerContainer<String, ObjectRecord<String, Info>> alarmStream() {
|
public StreamMessageListenerContainer<String, ObjectRecord<String, Info>> alarmStream() {
|
||||||
/* 创建Stream和消费组 */
|
/* 创建Stream和消费组 */
|
||||||
|
@ -53,7 +58,7 @@ public class RedisStreamConfig {
|
||||||
// 原子整数,多线程环境下对整数的原子性操作
|
// 原子整数,多线程环境下对整数的原子性操作
|
||||||
AtomicInteger index = new AtomicInteger(1);
|
AtomicInteger index = new AtomicInteger(1);
|
||||||
// 返回当前系统可用的处理器数量
|
// 返回当前系统可用的处理器数量
|
||||||
Integer processors = Runtime.getRuntime().availableProcessors();
|
Integer processors = maximumPoolSizeProperties.getStation();//Runtime.getRuntime().availableProcessors();
|
||||||
/*
|
/*
|
||||||
corePoolSize:线程池中核心线程的数量,即线程池中保持的最小线程数
|
corePoolSize:线程池中核心线程的数量,即线程池中保持的最小线程数
|
||||||
maximumPoolSize:线程池中允许的最大线程数
|
maximumPoolSize:线程池中允许的最大线程数
|
||||||
|
|
|
@ -3,6 +3,7 @@ package org.jeecg;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.jeecg.common.CalculateStationData;
|
import org.jeecg.common.CalculateStationData;
|
||||||
|
import org.jeecg.common.properties.MaximumPoolSizeProperties;
|
||||||
import org.jeecg.common.util.RedisUtil;
|
import org.jeecg.common.util.RedisUtil;
|
||||||
import org.jeecg.modules.base.entity.configuration.GardsStations;
|
import org.jeecg.modules.base.entity.configuration.GardsStations;
|
||||||
import org.jeecg.modules.entity.data.RateParam;
|
import org.jeecg.modules.entity.data.RateParam;
|
||||||
|
@ -26,6 +27,8 @@ public class DataProvisionEfficiencyManager {
|
||||||
|
|
||||||
private final CalculateStationData calCulateStationData;
|
private final CalculateStationData calCulateStationData;
|
||||||
|
|
||||||
|
private final MaximumPoolSizeProperties maximumPoolSizeProperties;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 开始
|
* 开始
|
||||||
*/
|
*/
|
||||||
|
@ -44,7 +47,7 @@ public class DataProvisionEfficiencyManager {
|
||||||
|
|
||||||
public void init(){
|
public void init(){
|
||||||
//获取机器可用核心数
|
//获取机器可用核心数
|
||||||
int systemCores = Runtime.getRuntime().availableProcessors();
|
int systemCores = maximumPoolSizeProperties.getStation();//Runtime.getRuntime().availableProcessors();
|
||||||
//初始化线程池
|
//初始化线程池
|
||||||
ThreadFactory threadFactory = new CustomizableThreadFactory("provision-efficiency-");
|
ThreadFactory threadFactory = new CustomizableThreadFactory("provision-efficiency-");
|
||||||
poolExecutor = new ThreadPoolExecutor(systemCores-1,systemCores,5, TimeUnit.SECONDS, new LinkedBlockingQueue<>(),threadFactory);
|
poolExecutor = new ThreadPoolExecutor(systemCores-1,systemCores,5, TimeUnit.SECONDS, new LinkedBlockingQueue<>(),threadFactory);
|
||||||
|
|
|
@ -7,6 +7,7 @@ import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.jeecg.common.CacheName;
|
import org.jeecg.common.CacheName;
|
||||||
import org.jeecg.common.config.mqtoken.UserTokenContext;
|
import org.jeecg.common.config.mqtoken.UserTokenContext;
|
||||||
|
import org.jeecg.common.properties.MaximumPoolSizeProperties;
|
||||||
import org.jeecg.common.util.DateUtils;
|
import org.jeecg.common.util.DateUtils;
|
||||||
import org.jeecg.common.util.RedisUtil;
|
import org.jeecg.common.util.RedisUtil;
|
||||||
import org.jeecg.modules.base.entity.original.GardsMetData;
|
import org.jeecg.modules.base.entity.original.GardsMetData;
|
||||||
|
@ -47,6 +48,8 @@ public class DataReceivingStatusManager {
|
||||||
|
|
||||||
private final StationSohDataMapper stationSohDataMapper;
|
private final StationSohDataMapper stationSohDataMapper;
|
||||||
|
|
||||||
|
private final MaximumPoolSizeProperties maximumPoolSizeProperties;
|
||||||
|
|
||||||
public void start() {
|
public void start() {
|
||||||
ReceivingStatusThreadManager receivingStatusManager = new ReceivingStatusThreadManager();
|
ReceivingStatusThreadManager receivingStatusManager = new ReceivingStatusThreadManager();
|
||||||
receivingStatusManager.init();
|
receivingStatusManager.init();
|
||||||
|
@ -62,7 +65,7 @@ public class DataReceivingStatusManager {
|
||||||
|
|
||||||
public void init(){
|
public void init(){
|
||||||
//获取机器可用核心数
|
//获取机器可用核心数
|
||||||
int systemCores = Runtime.getRuntime().availableProcessors();
|
int systemCores = maximumPoolSizeProperties.getStation();//Runtime.getRuntime().availableProcessors();
|
||||||
//初始化线程池
|
//初始化线程池
|
||||||
ThreadFactory threadFactory = new CustomizableThreadFactory("undeal-file-parsing-");
|
ThreadFactory threadFactory = new CustomizableThreadFactory("undeal-file-parsing-");
|
||||||
poolExecutor = new ThreadPoolExecutor(systemCores-1,systemCores,5, TimeUnit.SECONDS, new LinkedBlockingQueue<>(),threadFactory);
|
poolExecutor = new ThreadPoolExecutor(systemCores-1,systemCores,5, TimeUnit.SECONDS, new LinkedBlockingQueue<>(),threadFactory);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package org.jeecg.common;
|
package org.jeecg.common;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.jeecg.common.properties.MaximumPoolSizeProperties;
|
||||||
import org.jeecg.common.properties.ParameterProperties;
|
import org.jeecg.common.properties.ParameterProperties;
|
||||||
import org.jeecg.common.util.RedisUtil;
|
import org.jeecg.common.util.RedisUtil;
|
||||||
import org.jeecg.modules.entity.data.*;
|
import org.jeecg.modules.entity.data.*;
|
||||||
|
@ -25,6 +26,8 @@ public class CalculateStationData {
|
||||||
@Autowired
|
@Autowired
|
||||||
private ParameterProperties parameterProperties;
|
private ParameterProperties parameterProperties;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
private MaximumPoolSizeProperties maximumPoolSizeProperties;
|
||||||
|
@Autowired
|
||||||
private RedisUtil redisUtil;
|
private RedisUtil redisUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -837,7 +840,7 @@ public class CalculateStationData {
|
||||||
// 如果线程数不等于0
|
// 如果线程数不等于0
|
||||||
if (threadNum != 0){
|
if (threadNum != 0){
|
||||||
//获取机器可用核心数
|
//获取机器可用核心数
|
||||||
int maximumPoolSize = Runtime.getRuntime().availableProcessors();
|
int maximumPoolSize = maximumPoolSizeProperties.getStation();//Runtime.getRuntime().availableProcessors();
|
||||||
//初始化线程池
|
//初始化线程池
|
||||||
ThreadFactory threadFactory = new ThreadFactory() {
|
ThreadFactory threadFactory = new ThreadFactory() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -147,6 +147,7 @@ public class GardsSampleDataWebServiceImpl extends ServiceImpl<GardsSampleDataWe
|
||||||
if (StringUtils.isNotBlank(filePath)) {
|
if (StringUtils.isNotBlank(filePath)) {
|
||||||
file = ftpUtil.downloadFile(ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + filePath, "betaGamma");
|
file = ftpUtil.downloadFile(ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + filePath, "betaGamma");
|
||||||
if (Objects.nonNull(file)) {
|
if (Objects.nonNull(file)) {
|
||||||
|
// System.load("/usr/local/jdk/lib/libReadPHDFile.so");
|
||||||
System.loadLibrary("ReadPHDFile");
|
System.loadLibrary("ReadPHDFile");
|
||||||
EnergySpectrumStruct sourceData = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
|
EnergySpectrumStruct sourceData = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
|
||||||
//查询info
|
//查询info
|
||||||
|
|
|
@ -16,4 +16,5 @@ spring:
|
||||||
import:
|
import:
|
||||||
- optional:nacos:armd.yaml
|
- optional:nacos:armd.yaml
|
||||||
- optional:nacos:IDC-Data.yaml
|
- optional:nacos:IDC-Data.yaml
|
||||||
- optional:nacos:armd-@profile.name@.yaml
|
- optional:nacos:armd-@profile.name@.yaml
|
||||||
|
- optional:nacos:armd-analysis-@profile.name@.yaml
|
|
@ -59,9 +59,12 @@ public class JeecgSpectrumAnalysisApplication extends SpringBootServletInitializ
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(String... args) throws Exception {
|
public void run(String... args) throws Exception {
|
||||||
//加载dll工具库
|
//Windows加载dll工具库
|
||||||
System.loadLibrary("ReadPHDFile");
|
System.loadLibrary("ReadPHDFile");
|
||||||
System.loadLibrary("GammaAnaly");
|
System.loadLibrary("GammaAnaly");
|
||||||
|
//Linux版本加载dll工具库
|
||||||
|
// System.load("/usr/local/jdk/lib/libReadPHDFile.so");
|
||||||
|
// System.load("/usr/local/jdk/lib/libGammaAnalyALG.so");
|
||||||
//创建缓存
|
//创建缓存
|
||||||
betaCache.initCache();
|
betaCache.initCache();
|
||||||
localCache.initCache();
|
localCache.initCache();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user