/** 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()
}
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)
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.")