import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.newSingleThreadContext
import kotlinx.coroutines.withContext
-import org.onap.ccsdk.cds.blueprintsprocessor.core.service.BlueprintClusterService
+import org.onap.ccsdk.cds.blueprintsprocessor.core.service.BluePrintClusterService
import org.onap.ccsdk.cds.blueprintsprocessor.core.service.ClusterLock
import org.onap.ccsdk.cds.blueprintsprocessor.core.service.ClusterMember
-import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants
-import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintException
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.cds.controllerblueprints.core.MDCContext
-import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintDependencyService
+import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintDependencyService
/**
* Exposed Dependency Service by this Hazelcast Lib Module
*/
-fun BlueprintDependencyService.clusterService(): BlueprintClusterService =
+fun BluePrintDependencyService.clusterService(): BluePrintClusterService =
instance(HazelcastClusterService::class)
/** Optional Cluster Service, returns only if Cluster is enabled */
-fun BlueprintDependencyService.optionalClusterService(): BlueprintClusterService? {
- return if (BlueprintConstants.CLUSTER_ENABLED) {
- BlueprintDependencyService.clusterService()
+fun BluePrintDependencyService.optionalClusterService(): BluePrintClusterService? {
+ return if (BluePrintConstants.CLUSTER_ENABLED) {
+ BluePrintDependencyService.clusterService()
} else null
}
/** Extension to convert Hazelcast Member to Blueprints Cluster Member */
fun Member.toClusterMember(): ClusterMember {
- val memberName: String = this.getAttribute(BlueprintConstants.PROPERTY_CLUSTER_NODE_ID) ?: this.uuid.toString()
+ val memberName: String = this.getAttribute(BluePrintConstants.PROPERTY_CLUSTER_NODE_ID) ?: this.uuid.toString()
return ClusterMember(
id = this.uuid.toString(),
name = memberName,
/**
* This function will try to acquire the lock and then execute the provided block.
- * If the lock cannot be acquired within timeout, a BlueprintException will be thrown.
+ * If the lock cannot be acquired within timeout, a BluePrintException will be thrown.
*
* Since a lock can only be unlocked by the the thread which acquired the lock,
* this function will confine coroutines within the block to a dedicated thread.
lock.unLock()
}
} else
- throw BlueprintException("Failed to acquire lock within timeout")
+ throw BluePrintException("Failed to acquire lock within timeout")
}
}
}