summaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/modules/services/execution-service
diff options
context:
space:
mode:
authorSebastien Premont-Tendland <sebastien.premont@bell.ca>2020-03-02 14:33:33 -0500
committerSebastien Premont-Tendland <sebastien.premont@bell.ca>2020-03-19 13:28:18 +0000
commit0562fc1c7378be67b571bb142489272a6b1b3814 (patch)
treebcf38c342cb21710725eb89c8b7cc25c91f13e66 /ms/blueprintsprocessor/modules/services/execution-service
parentfa12b4f311e77612e4e856b209a8c81c71f0b29d (diff)
Fix kotlin cache lazy loading
When USE_SCRIPT_COMPILATION_CACHE is set to false the classLoader is closed after the class is instantiated. This is causing an issue when lazy loading is happening during the script execution. Lazy loading occurs when a suspendible function returning something is called from "processNB", kotlin will create a second class that will be loaded during execution (needs to be in the classpath during execution). Issue-ID: CCSDK-2150 Signed-off-by: Sebastien Premont-Tendland <sebastien.premont@bell.ca> Change-Id: I64780287352d762325662e0e5d5b94038dedee7f
Diffstat (limited to 'ms/blueprintsprocessor/modules/services/execution-service')
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentFunctionScriptingService.kt6
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentScriptExecutor.kt2
2 files changed, 8 insertions, 0 deletions
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentFunctionScriptingService.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentFunctionScriptingService.kt
index 4c7d5d0ec..34b18091f 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentFunctionScriptingService.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentFunctionScriptingService.kt
@@ -101,4 +101,10 @@ class ComponentFunctionScriptingService(
}
return scriptComponent
}
+
+ suspend fun cleanupInstance(bluePrintContext: BluePrintContext, scriptType: String) {
+ if (scriptType == BluePrintConstants.SCRIPT_KOTLIN) {
+ BluePrintScriptsServiceImpl().cleanupInstance(bluePrintContext.rootPath)
+ }
+ }
}
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentScriptExecutor.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentScriptExecutor.kt
index 09eee6717..2a63297be 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentScriptExecutor.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentScriptExecutor.kt
@@ -60,6 +60,8 @@ open class ComponentScriptExecutor(private var componentFunctionScriptingService
// Handles both script processing and error handling
scriptComponentFunction.executeScript(executionServiceInput)
+
+ componentFunctionScriptingService.cleanupInstance(bluePrintRuntimeService.bluePrintContext(), scriptType)
}
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {