aboutsummaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org
diff options
context:
space:
mode:
authorJozsef Csongvai <jozsef.csongvai@bell.ca>2020-06-22 14:05:45 -0400
committerJozsef Csongvai <jozsef.csongvai@bell.ca>2020-06-22 14:18:57 -0400
commitc0ae9f7eff91b8cd8e0567adaadbc766c10c3c3c (patch)
tree43146654593475508f243a4937bf6085a6196630 /ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org
parentee2c950e05901c92fd45a24898b7e8bb2418bc77 (diff)
Fix exception handling in AbstractComponentFunction
Moved try-catch to applyNB so that it also catches exceptions in prepareRequestNB. This restores exception handling to the way it was before introduction of locking feature. Issue-ID: CCSDK-2460 Signed-off-by: Jozsef Csongvai <jozsef.csongvai@bell.ca> Change-Id: I20326d9a79ac5fbae630eda8530e8428cdb4f84c
Diffstat (limited to 'ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org')
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractComponentFunction.kt30
1 files changed, 15 insertions, 15 deletions
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractComponentFunction.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractComponentFunction.kt
index 211bf76fb..4cd809778 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractComponentFunction.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractComponentFunction.kt
@@ -105,7 +105,7 @@ abstract class AbstractComponentFunction : BlueprintFunctionNode<ExecutionServic
/** Resolve and validate lock properties */
implementation.lock?.apply {
val resolvedValues = bluePrintRuntimeService.resolvePropertyAssignments(
- nodeTemplateName,
+ BluePrintConstants.MODEL_DEFINITION_TYPE_NODE_TEMPLATE,
interfaceName,
mutableMapOf("key" to this.key, "acquireTimeout" to this.acquireTimeout))
this.key = resolvedValues["key"] ?: "".asJsonType()
@@ -153,21 +153,14 @@ abstract class AbstractComponentFunction : BlueprintFunctionNode<ExecutionServic
}
override suspend fun applyNB(executionServiceInput: ExecutionServiceInput): ExecutionServiceOutput {
- prepareRequestNB(executionServiceInput)
- return implementation.lock?.let {
- bluePrintClusterService.clusterLock("${it.key.textValue()}@$CDS_LOCK_GROUP")
- .executeWithLock(it.acquireTimeout.intValue().times(1000).toLong()) {
- applyNBWithTimeout(executionServiceInput)
- }
- } ?: applyNBWithTimeout(executionServiceInput)
- }
-
- private suspend fun applyNBWithTimeout(executionServiceInput: ExecutionServiceInput): ExecutionServiceOutput {
try {
- withTimeout((implementation.timeout * 1000).toLong()) {
- log.debug("DEBUG::: AbstractComponentFunction.withTimeout section ${implementation.timeout} seconds")
- processNB(executionServiceInput)
- }
+ prepareRequestNB(executionServiceInput)
+ implementation.lock?.let {
+ bluePrintClusterService.clusterLock("${it.key.textValue()}@$CDS_LOCK_GROUP")
+ .executeWithLock(it.acquireTimeout.intValue().times(1000).toLong()) {
+ applyNBWithTimeout(executionServiceInput)
+ }
+ } ?: applyNBWithTimeout(executionServiceInput)
} catch (runtimeException: RuntimeException) {
log.error("failed in ${getName()} : ${runtimeException.message}", runtimeException)
recoverNB(runtimeException, executionServiceInput)
@@ -175,6 +168,13 @@ abstract class AbstractComponentFunction : BlueprintFunctionNode<ExecutionServic
return prepareResponseNB()
}
+ private suspend fun applyNBWithTimeout(executionServiceInput: ExecutionServiceInput) =
+ withTimeout((implementation.timeout * 1000).toLong()) {
+ log.debug("DEBUG::: AbstractComponentFunction.withTimeout " +
+ "section ${implementation.timeout} seconds")
+ processNB(executionServiceInput)
+ }
+
fun getOperationInput(key: String): JsonNode {
return operationInputs[key]
?: throw BluePrintProcessorException("couldn't get the operation input($key) value.")