Merge SW Upgrade Blueprint into PNF_AAI and create one UAT BP for PNF
[ccsdk/cds.git] / ms / blueprintsprocessor / modules / commons / processor-core / src / main / kotlin / org / onap / ccsdk / cds / blueprintsprocessor / core / cluster / HazlecastClusterService.kt
index 6be3334..a58c077 100644 (file)
@@ -243,8 +243,11 @@ open class ClusterLockImpl(private val hazelcast: HazelcastInstance, private val
     }
 
     override suspend fun unLock() {
-        distributedLock.unlock()
-        log.trace("Cluster unlock(${name()}) successfully..")
+        // Added condition to avoid failures like - "Current thread is not owner of the lock!"
+        if (distributedLock.isLockedByCurrentThread) {
+            distributedLock.unlock()
+            log.trace("Cluster unlock(${name()}) successfully..")
+        }
     }
 
     override fun isLocked(): Boolean {