Commit 5fcfde8a by 王祖波

key

parent 7082606a
......@@ -44,6 +44,8 @@ public class HoloDataSource implements InitializingBean, DisposableBean {
private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
public static final String HOLO_CONNECTIONMAXIDLEMS = "holo.connectionMaxIdleMs";
@PostConstruct
public void initConfig() {
Config config = ConfigService.getAppConfig();
......@@ -56,7 +58,7 @@ public class HoloDataSource implements InitializingBean, DisposableBean {
}
TraceIdUtil.traceBegin(TraceIdUtil.EntranceType.QUARTZ);
log.info("监听刷新holo");
ConfigChange connectionMaxIdleMsChange = changeEvent.getChange("holo.connectionMaxIdleMs");
ConfigChange connectionMaxIdleMsChange = changeEvent.getChange(HOLO_CONNECTIONMAXIDLEMS);
if ((connectionMaxIdleMsChange != null && connectionMaxIdleMsChange.getNewValue() != null)) {
init();
}
......
......@@ -2,6 +2,7 @@ package com.gic.haoban.manage.service.util;
import com.ctrip.framework.apollo.Config;
import com.ctrip.framework.apollo.ConfigService;
import com.gic.haoban.manage.service.dao.mapper.content.holo.HoloDataSource;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -99,7 +100,7 @@ public class ApolloUtils {
*/
public static Integer connectionMaxIdleMs() {
Config config = ConfigService.getAppConfig();
String connectionMaxIdleMs = config.getProperty("holo.connectionMaxIdleMs", "9000");
String connectionMaxIdleMs = config.getProperty(HoloDataSource.HOLO_CONNECTIONMAXIDLEMS, "9000");
return Integer.parseInt(connectionMaxIdleMs);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment