定期删除线程池历史运行数据任务添加开关. (#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}")
private Long cleanHistoryDataPeriod;
@Value("${clean.history.data.period.enable:true}")
private Boolean cleanHistoryDataPeriodEnable;
@NonNull
private final HisRunDataService hisRunDataService;
private final ScheduledExecutorService cleanHistoryDataExecutor = ExecutorFactory.Managed
.newSingleScheduledExecutorService(DEFAULT_GROUP, r -> new Thread(r, "clean-history-data"));
private ScheduledExecutorService cleanHistoryDataExecutor;
@Override
public void run() {
@ -51,7 +53,11 @@ public class TimeCleanHistoryDataTask implements Runnable, InitializingBean {
@Override
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.
clean.history.data.period=30
clean.history.data.period.enable=true
#*************** Config Module Related Configurations ***************#

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

Loading…
Cancel
Save