定期删除线程池历史运行数据任务添加开关. (#33)

pull/39/head
chen.ma 3 years ago
parent 17f457c944
commit 0709cb3894

@ -32,11 +32,13 @@ public class TimeCleanHistoryDataTask implements Runnable, InitializingBean {
@Value("${clean.history.data.period:30}") @Value("${clean.history.data.period:30}")
private Long cleanHistoryDataPeriod; private Long cleanHistoryDataPeriod;
@Value("${clean.history.data.period.enable:true}")
private Boolean cleanHistoryDataPeriodEnable;
@NonNull @NonNull
private final HisRunDataService hisRunDataService; private final HisRunDataService hisRunDataService;
private final ScheduledExecutorService cleanHistoryDataExecutor = ExecutorFactory.Managed private ScheduledExecutorService cleanHistoryDataExecutor;
.newSingleScheduledExecutorService(DEFAULT_GROUP, r -> new Thread(r, "clean-history-data"));
@Override @Override
public void run() { public void run() {
@ -51,7 +53,11 @@ public class TimeCleanHistoryDataTask implements Runnable, InitializingBean {
@Override @Override
public void afterPropertiesSet() throws Exception { public void afterPropertiesSet() throws Exception {
cleanHistoryDataExecutor.scheduleWithFixedDelay(this, 0, 1, TimeUnit.MINUTES); if (cleanHistoryDataPeriodEnable) {
cleanHistoryDataExecutor = ExecutorFactory.Managed
.newSingleScheduledExecutorService(DEFAULT_GROUP, r -> new Thread(r, "clean-history-data"));
cleanHistoryDataExecutor.scheduleWithFixedDelay(this, 0, 1, TimeUnit.MINUTES);
}
} }
} }

@ -18,6 +18,7 @@ tenant=hippo4j
### Regularly clean up the historical running data of thread pool. unit: minute. ### Regularly clean up the historical running data of thread pool. unit: minute.
clean.history.data.period=30 clean.history.data.period=30
clean.history.data.period.enable=true
#*************** Config Module Related Configurations ***************# #*************** Config Module Related Configurations ***************#

@ -18,6 +18,7 @@ tenant=hippo4j
### Regularly clean up the historical running data of thread pool. unit: minute. ### Regularly clean up the historical running data of thread pool. unit: minute.
clean.history.data.period=30 clean.history.data.period=30
clean.history.data.period.enable=true
#*************** Config Module Related Configurations ***************# #*************** Config Module Related Configurations ***************#

Loading…
Cancel
Save