diff --git a/hippo4j-config/src/main/java/cn/hippo4j/config/monitor/TimeCleanHistoryDataTask.java b/hippo4j-config/src/main/java/cn/hippo4j/config/monitor/TimeCleanHistoryDataTask.java index 5a8f9092..988c0b5c 100644 --- a/hippo4j-config/src/main/java/cn/hippo4j/config/monitor/TimeCleanHistoryDataTask.java +++ b/hippo4j-config/src/main/java/cn/hippo4j/config/monitor/TimeCleanHistoryDataTask.java @@ -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); + } } } diff --git a/hippo4j-server/conf/application.properties b/hippo4j-server/conf/application.properties index 11ec45cb..6f5c9ccf 100644 --- a/hippo4j-server/conf/application.properties +++ b/hippo4j-server/conf/application.properties @@ -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 ***************# diff --git a/hippo4j-server/src/main/resources/application.properties b/hippo4j-server/src/main/resources/application.properties index 11ec45cb..6f5c9ccf 100644 --- a/hippo4j-server/src/main/resources/application.properties +++ b/hippo4j-server/src/main/resources/application.properties @@ -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 ***************#