交换机采集数据优化
This commit is contained in:
@@ -16,7 +16,7 @@ public class SchedulerConfig {
|
|||||||
@Bean
|
@Bean
|
||||||
public ThreadPoolTaskScheduler taskScheduler() {
|
public ThreadPoolTaskScheduler taskScheduler() {
|
||||||
ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
|
ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
|
||||||
scheduler.setPoolSize(10); // 核心线程数
|
scheduler.setPoolSize(50); // 核心线程数
|
||||||
scheduler.setThreadNamePrefix("dynamic-scheduler-");
|
scheduler.setThreadNamePrefix("dynamic-scheduler-");
|
||||||
scheduler.setAwaitTerminationSeconds(60);
|
scheduler.setAwaitTerminationSeconds(60);
|
||||||
scheduler.setWaitForTasksToCompleteOnShutdown(true);
|
scheduler.setWaitForTasksToCompleteOnShutdown(true);
|
||||||
@@ -28,7 +28,7 @@ public class SchedulerConfig {
|
|||||||
@Bean("taskExecutor")
|
@Bean("taskExecutor")
|
||||||
public ThreadPoolTaskScheduler taskExecutor() {
|
public ThreadPoolTaskScheduler taskExecutor() {
|
||||||
ThreadPoolTaskScheduler executor = new ThreadPoolTaskScheduler();
|
ThreadPoolTaskScheduler executor = new ThreadPoolTaskScheduler();
|
||||||
executor.setPoolSize(11); // 工作线程数
|
executor.setPoolSize(50); // 工作线程数
|
||||||
executor.setThreadNamePrefix("task-worker-");
|
executor.setThreadNamePrefix("task-worker-");
|
||||||
executor.setAwaitTerminationSeconds(30);
|
executor.setAwaitTerminationSeconds(30);
|
||||||
executor.setWaitForTasksToCompleteOnShutdown(true);
|
executor.setWaitForTasksToCompleteOnShutdown(true);
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ public class AgentServiceImpl implements AgentService {
|
|||||||
if(GlobalConfig.netCollect != collect || GlobalConfig.netInterval != interval){
|
if(GlobalConfig.netCollect != collect || GlobalConfig.netInterval != interval){
|
||||||
GlobalConfig.netCollect = collect;
|
GlobalConfig.netCollect = collect;
|
||||||
if(collect){
|
if(collect){
|
||||||
GlobalConfig.netInterval = interval;
|
// GlobalConfig.netInterval = interval;
|
||||||
long milli = AgentUtil.millisecondsToNext5Minute();
|
long milli = AgentUtil.millisecondsToNext5Minute();
|
||||||
dynamicTaskService.scheduleTask(type,
|
dynamicTaskService.scheduleTask(type,
|
||||||
businessTasks::netTask, milli, GlobalConfig.netInterval*1000L);
|
businessTasks::netTask, milli, GlobalConfig.netInterval*1000L);
|
||||||
@@ -410,10 +410,10 @@ public class AgentServiceImpl implements AgentService {
|
|||||||
if(GlobalConfig.switchNetCollect != collect || GlobalConfig.switchNetInterval != interval){
|
if(GlobalConfig.switchNetCollect != collect || GlobalConfig.switchNetInterval != interval){
|
||||||
flag = true;
|
flag = true;
|
||||||
GlobalConfig.switchNetCollect = collect;
|
GlobalConfig.switchNetCollect = collect;
|
||||||
GlobalConfig.switchNetInterval = interval;
|
// GlobalConfig.switchNetInterval = interval;
|
||||||
if(!collect){
|
// if(!collect){
|
||||||
GlobalConfig.switchNetInterval = 300;
|
// GlobalConfig.switchNetInterval = 300;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "switchModuleCollect": //光模块采集
|
case "switchModuleCollect": //光模块采集
|
||||||
@@ -598,7 +598,11 @@ public class AgentServiceImpl implements AgentService {
|
|||||||
}
|
}
|
||||||
if (flag) {
|
if (flag) {
|
||||||
if(collect){
|
if(collect){
|
||||||
long milli = AgentUtil.millisecondsToNext5Minute();
|
long milli = AgentUtil.getMillisToNextMinute() + 60000;
|
||||||
|
if(StringUtils.equals(type,"switchNetCollect")){
|
||||||
|
milli = AgentUtil.millisecondsToNext5Minute();
|
||||||
|
interval = 300;
|
||||||
|
}
|
||||||
dynamicTaskService.scheduleTask(type,
|
dynamicTaskService.scheduleTask(type,
|
||||||
() -> businessTasks.switchBoardTask(type), milli, interval*1000L);
|
() -> businessTasks.switchBoardTask(type), milli, interval*1000L);
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
Reference in New Issue
Block a user