LOCK on Global vars, is it necessary in this case?
I have a business process that adds data to a global variable on receipt of an HL7 message, and a scheduled task that executes a class method defined within the same business process that removes data from the same global variable. With this in mind it makes sense to consider concurrency and therefore make use of the LOCK command.
My first question is whether this is actually necessary?
My second question is what happens to locks when an error/exception is encountered after a lock but before the code to release the lock, is this managed automatically or should try-catch be used to release the lock given an error?
Comments
#2)
Every LOCK persists until the process is ended or the LOCK is removed explicitely (LOCK -....)
it is not related to any error handling.
#1)
depends on your design.
If there is no conflict of subscripts between ADD and REMOVE possible there is no need of a Lock