Implicit and Explicit Locking for Metrics

When a metric is being computed, it is necessary to acquire a lock to prevent corruption of the metric instance. This protects the metric instance from getting updated from multiple threads.

TIBCO BusinessEvents offers the locking mechanism by using the lock function when you call the compute method.

By default, the locking is done implicitly and at the level of metric instance. If you wish to update the same metric instance more than once in one RTC or control the lock granularity, then you need to use explicit locking. Use the following property to configure explicit locking:

be.engine.metric.lock.enable=true

If you wish to use explicit locking and keep the lock granularity at the metric instance level, use the getMetricExtId ontology function. The return value of getMetricExtId is unique for each metric instance, and can be used as an argument to the lock function.