diff options
Diffstat (limited to 'ms/blueprintsprocessor/modules/commons/processor-core')
7 files changed, 35 insertions, 71 deletions
diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/HazlecastClusterService.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/HazlecastClusterService.kt index 6be3334bb..a58c077fa 100644 --- a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/HazlecastClusterService.kt +++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/HazlecastClusterService.kt @@ -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 { diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/HazlecastClusterServiceTest.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/HazlecastClusterServiceTest.kt index b298eacae..80cf41558 100644 --- a/ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/HazlecastClusterServiceTest.kt +++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/HazlecastClusterServiceTest.kt @@ -113,7 +113,7 @@ class HazlecastClusterServiceTest { } else { ClusterInfo( id = "test-cluster", nodeId = nodeId, joinAsClient = false, - configFile = "./src/test/resources/hazelcast/hazelcast-$port.yaml", + configFile = "./src/test/resources/hazelcast/hazelcast-cluster.yaml", properties = properties ) } @@ -162,7 +162,7 @@ class HazlecastClusterServiceTest { executeLock(bluePrintClusterServices[0], "first", lockName) } val deferred2 = async { - executeLock(bluePrintClusterServices[0], "second", lockName) + executeLock(bluePrintClusterServices[1], "second", lockName) } val deferred3 = async { executeLock(bluePrintClusterServices[2], "third", lockName) diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/test/resources/hazelcast/hazelcast-5679.yaml b/ms/blueprintsprocessor/modules/commons/processor-core/src/test/resources/hazelcast/hazelcast-5679.yaml deleted file mode 100644 index e7ac273ed..000000000 --- a/ms/blueprintsprocessor/modules/commons/processor-core/src/test/resources/hazelcast/hazelcast-5679.yaml +++ /dev/null @@ -1,21 +0,0 @@ -hazelcast: - cluster-name: ${CLUSTER_ID} - instance-name: node-5679 - lite-member: - enabled: false - cp-subsystem: - cp-member-count: 3 - group-size: 3 - session-time-to-live-seconds: 60 - session-heartbeat-interval-seconds: 5 - missing-cp-member-auto-removal-seconds: 120 -# network: -# join: -# multicast: -# enabled: false -# kubernetes: -# enabled: true -# namespace: MY-KUBERNETES-NAMESPACE -# service-name: MY-SERVICE-NAME -# service-label-name: MY-SERVICE-LABEL-NAME -# service-label-value: MY-SERVICE-LABEL-VALUE
\ No newline at end of file diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/test/resources/hazelcast/hazelcast-5680.yaml b/ms/blueprintsprocessor/modules/commons/processor-core/src/test/resources/hazelcast/hazelcast-5680.yaml deleted file mode 100644 index cb493d169..000000000 --- a/ms/blueprintsprocessor/modules/commons/processor-core/src/test/resources/hazelcast/hazelcast-5680.yaml +++ /dev/null @@ -1,21 +0,0 @@ -hazelcast: - cluster-name: ${CLUSTER_ID} - instance-name: node-5680 - lite-member: - enabled: false - cp-subsystem: - cp-member-count: 3 - group-size: 3 - session-time-to-live-seconds: 60 - session-heartbeat-interval-seconds: 5 - missing-cp-member-auto-removal-seconds: 120 -# network: -# join: -# multicast: -# enabled: false -# kubernetes: -# enabled: true -# namespace: MY-KUBERNETES-NAMESPACE -# service-name: MY-SERVICE-NAME -# service-label-name: MY-SERVICE-LABEL-NAME -# service-label-value: MY-SERVICE-LABEL-VALUE
\ No newline at end of file diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/test/resources/hazelcast/hazelcast-5681.yaml b/ms/blueprintsprocessor/modules/commons/processor-core/src/test/resources/hazelcast/hazelcast-5681.yaml deleted file mode 100644 index e60b0c506..000000000 --- a/ms/blueprintsprocessor/modules/commons/processor-core/src/test/resources/hazelcast/hazelcast-5681.yaml +++ /dev/null @@ -1,21 +0,0 @@ -hazelcast: - cluster-name: ${CLUSTER_ID} - instance-name: node-5681 - lite-member: - enabled: false - cp-subsystem: - cp-member-count: 3 - group-size: 3 - session-time-to-live-seconds: 60 - session-heartbeat-interval-seconds: 5 - missing-cp-member-auto-removal-seconds: 120 -# network: -# join: -# multicast: -# enabled: false -# kubernetes: -# enabled: true -# namespace: MY-KUBERNETES-NAMESPACE -# service-name: MY-SERVICE-NAME -# service-label-name: MY-SERVICE-LABEL-NAME -# service-label-value: MY-SERVICE-LABEL-VALUE
\ No newline at end of file diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/test/resources/hazelcast/hazelcast-5682.yaml b/ms/blueprintsprocessor/modules/commons/processor-core/src/test/resources/hazelcast/hazelcast-5682.yaml index 3cb10a08b..859ea3328 100644 --- a/ms/blueprintsprocessor/modules/commons/processor-core/src/test/resources/hazelcast/hazelcast-5682.yaml +++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/test/resources/hazelcast/hazelcast-5682.yaml @@ -9,10 +9,11 @@ hazelcast: session-time-to-live-seconds: 60 session-heartbeat-interval-seconds: 5 missing-cp-member-auto-removal-seconds: 120 -# network: -# join: -# multicast: -# enabled: false + network: + join: + multicast: + enabled: true + multicast-group: 224.0.0.1 # kubernetes: # enabled: true # namespace: MY-KUBERNETES-NAMESPACE diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/test/resources/hazelcast/hazelcast-cluster.yaml b/ms/blueprintsprocessor/modules/commons/processor-core/src/test/resources/hazelcast/hazelcast-cluster.yaml new file mode 100644 index 000000000..de6047a90 --- /dev/null +++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/test/resources/hazelcast/hazelcast-cluster.yaml @@ -0,0 +1,23 @@ +hazelcast: + lite-member: + enabled: false + cp-subsystem: + cp-member-count: 3 + group-size: 3 + session-time-to-live-seconds: 60 + session-heartbeat-interval-seconds: 5 + missing-cp-member-auto-removal-seconds: 120 + network: + join: + multicast: + enabled: true + # Specify 224.0.0.1 instead of default 224.2.2.3 since there's some issue + # on macOs with docker installed and multicast address different than 224.0.0.1 + # https://stackoverflow.com/questions/46341715/hazelcast-multicast-does-not-work-because-of-vboxnet-which-is-used-by-docker-mac + multicast-group: 224.0.0.1 + # kubernetes: + # enabled: true + # namespace: MY-KUBERNETES-NAMESPACE + # service-name: MY-SERVICE-NAME + # service-label-name: MY-SERVICE-LABEL-NAME + # service-label-value: MY-SERVICE-LABEL-VALUE |