summaryrefslogtreecommitdiffstats
path: root/ms/controllerblueprints/modules
diff options
context:
space:
mode:
Diffstat (limited to 'ms/controllerblueprints/modules')
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompilerCache.kt14
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompilerProxy.kt3
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintMetadataUtils.kt2
3 files changed, 13 insertions, 6 deletions
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompilerCache.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompilerCache.kt
index db139eb59..fa6b0ab97 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompilerCache.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompilerCache.kt
@@ -30,7 +30,7 @@ object BluePrintCompileCache {
val log = logger(BluePrintCompileCache::class)
private val classLoaderCache: LoadingCache<String, URLClassLoader> = CacheBuilder.newBuilder()
- .maximumSize(10)
+ .maximumSize(50)
.build(BluePrintClassLoader)
fun classLoader(key: String): URLClassLoader {
@@ -38,8 +38,12 @@ object BluePrintCompileCache {
}
fun cleanClassLoader(key: String) {
- classLoaderCache.invalidate(key)
- log.info("Cleaned script cache($key)")
+ if(hasClassLoader(key)){
+ classLoaderCache.invalidate(key)
+ log.info("Cleaned compiled cache($key)")
+ }else{
+ log.warn("No compiled cache($key) present to clean.")
+ }
}
fun hasClassLoader(key: String): Boolean {
@@ -52,7 +56,7 @@ object BluePrintClassLoader : CacheLoader<String, URLClassLoader>() {
val log = logger(BluePrintClassLoader::class)
override fun load(key: String): URLClassLoader {
- log.info("loading cache key($key)")
+ log.info("loading compiled cache($key)")
val keyPath = normalizedFile(key)
if (!keyPath.exists()) {
throw BluePrintException("failed to load cache($key), missing files.")
@@ -61,7 +65,7 @@ object BluePrintClassLoader : CacheLoader<String, URLClassLoader>() {
keyPath.walkTopDown()
.filter { it.name.endsWith("cba-kts.jar") }
.forEach {
- log.debug("Adding (${it.absolutePath}) to cache key($key)")
+ log.debug("Adding (${it.absolutePath}) to cache($key)")
urls.add(it.toURI().toURL())
}
return URLClassLoader(urls.toTypedArray(), this.javaClass.classLoader)
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompilerProxy.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompilerProxy.kt
index e231f6d1c..546631240 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompilerProxy.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompilerProxy.kt
@@ -63,6 +63,9 @@ open class BluePrintsCompilerProxy(private val hostConfiguration: ScriptingHostC
/** Check cache is present for the blueprint scripts */
val hasCompiledCache = BluePrintCompileCache.hasClassLoader(blueprintSourceCode.cacheKey)
+ log.debug("Jar Exists : ${compiledJarFile.exists()}, Regenerate : ${blueprintSourceCode.regenerate}," +
+ " Compiled hash(${blueprintSourceCode.cacheKey}) : $hasCompiledCache")
+
if (!compiledJarFile.exists() || blueprintSourceCode.regenerate || !hasCompiledCache) {
log.info("compiling for cache key(${blueprintSourceCode.cacheKey})")
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintMetadataUtils.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintMetadataUtils.kt
index 3a1edccc0..669ab3fef 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintMetadataUtils.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintMetadataUtils.kt
@@ -186,7 +186,7 @@ class BluePrintMetadataUtils {
val bluePrintScriptsService = BluePrintScriptsServiceImpl()
val bluePrintDefinitions = bluePrintScriptsService
.scriptInstance<BluePrintDefinitions>(normalizedBasePath, toscaMetaData.templateName!!,
- toscaMetaData.templateVersion!!, definitionClassName, true)
+ toscaMetaData.templateVersion!!, definitionClassName, false)
// Get the Service Template
val serviceTemplate = bluePrintDefinitions.serviceTemplate()