diff options
Diffstat (limited to 'catalog-model/src/main')
-rw-r--r-- | catalog-model/src/main/java/org/openecomp/sdc/be/model/cache/ApplicationDataTypeCache.java | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/cache/ApplicationDataTypeCache.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/cache/ApplicationDataTypeCache.java index 954df91552..0b4d02a0ab 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/cache/ApplicationDataTypeCache.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/cache/ApplicationDataTypeCache.java @@ -206,13 +206,7 @@ public class ApplicationDataTypeCache implements ApplicationCache<DataTypeDefini @Override public void run() { try { - final long startTime = System.currentTimeMillis(); - log.trace("Starting refresh data types cache job"); - if (hasDataTypesChanged()) { - log.info("Detected changes in the data types, updating the data type cache."); - refreshDataTypesCache(); - } - log.trace("Finished refresh data types cache job. Finished in {}ms", (System.currentTimeMillis() - startTime)); + refreshDataTypesCacheIfStale(); } catch (final Exception e) { var errorMsg = "Failed to run refresh data types cache job"; log.error(EcompLoggerErrorCode.UNKNOWN_ERROR, ApplicationDataTypeCache.class.getName(), errorMsg, e); @@ -291,6 +285,16 @@ public class ApplicationDataTypeCache implements ApplicationCache<DataTypeDefini readWriteLock.readLock().unlock(); } } + + public void refreshDataTypesCacheIfStale() { + final long startTime = System.currentTimeMillis(); + log.trace("Starting refresh data types cache"); + if (hasDataTypesChanged()) { + log.info("Detected changes in the data types, updating the data type cache."); + refreshDataTypesCache(); + } + log.trace("Finished refresh data types cache. Finished in {}ms", (System.currentTimeMillis() - startTime)); + } private void refreshDataTypesCache() { final Map<String, Map<String, DataTypeDefinition>> dataTypesDefinitionMap = findAllDataTypesEager(); |