Use of Locks to Ensure Data Integrity Within and Across Agents
Objects are managed in a concurrent configuration so that multiple agents can read from and write to the same cache cluster and at times operate on the same set of objects.
Multiple threads in one agent can also behave in a similar manner, to enable concurrent RTCs.
Locking is one of the necessary costs of tuning inference agents for higher performance when concurrency features are used.
Locking is used to ensure the data you read is up-to-date, and to ensure that no other RTC is updating the same data concurrently.
- Locking in TIBCO BusinessEvents
The goal of locking is to ensure consistency across concurrent RTCs. - When to Use Locking
Depending on your application, locking may not be required in all cases. However it is almost always needed. - Lock Processing Example Flow
The following example demonstrates common locking requirements. - Lock and Unlock Functions
TIBCO BusinessEvents provides lock and unlock finctions. - Tips for Locks
The example LockExample (in BE_HOME/examples/standard) demonstrates these points, showing use of locks to prevent race conditions. - Multiple Keys Protect One Object
In the simplest cases you can use some unique feature of the object you want to protect as the locking key, for example, a customer ID. However different events may point to the same objects using different information. For example, from one channel, the object may be identified using customer ID, and from another, using account ID. In such cases multiple keys are used to identify the same object. When you acquire a lock to protect such an object, you must first get the other key from your system, sort the keys and take a lock on both keys. Sorting can be implemented using a custom function. - Lock Failures
Instead of throwing an exception after failing to acquire a lock after a few attempts, re-route the event to a special destination that only handles errors (an "error queue"), so you have control over which queue the message goes to.
Copyright © TIBCO Software Inc. All rights reserved.