diff --git a/core/src/main/java/com/netflix/conductor/core/execution/appconfig/cache/AppConfig.java b/core/src/main/java/com/netflix/conductor/core/execution/appconfig/cache/AppConfig.java index d12a5571d1..41c7590fbb 100644 --- a/core/src/main/java/com/netflix/conductor/core/execution/appconfig/cache/AppConfig.java +++ b/core/src/main/java/com/netflix/conductor/core/execution/appconfig/cache/AppConfig.java @@ -45,10 +45,28 @@ public AppConfig(AppConfigDAO appConfigDAO) { CacheManager cacheManager = CacheManager.getInstance(); appCache = cacheManager.getCache(APP_CACHE); this.appConfigDAO = appConfigDAO; + try { + initialize(); + } catch (Exception e) { + logger.error("Unable to load App Config ", e); + throw new RuntimeException(e); + } logger = LogManager.getLogger(AppConfig.class); logger.info("Initialized AppConfig"); } + /** + * Initialize the cache + * + * @return + * @throws Exception + */ + private void initialize() throws Exception { + synchronized (AppConfig.class){ + reloadProperties(""); + } + } + /** * Obtain the value for a specified key. Returns null if not found * @@ -125,7 +143,7 @@ public void removeConfig(String key) throws Exception { public synchronized void reloadProperties(String testKey) throws SQLException { if (appCache.get(testKey) == null) { appCache.invalidate(); - logger.info("AppConfig testKey " + testKey + ". Invalidating Cache "); + //logger.info("AppConfig testKey " + testKey + ". Invalidating Cache "); Map configValues = appConfigDAO.getConfigs(); configValues.entrySet().forEach(configValue -> appCache.put(configValue.getKey(), StrSubstitutor.replace(configValue.getValue(), System.getenv()), TTL_SECONDS)); }