Code: Select all
validate the transaction
exclusively lock something
allocate the number, persist it
unlock something
Code: Select all
validate the transaction
exclusively lock something
allocate the number, persist it
unlock something
That would work, depending on the approach you take. Typically it would be something like:So the psuedo code goes like this. The locking is required for it to be single-threading.
Code: Select all
validate the transaction exclusively lock something allocate the number, persist it unlock something
Code: Select all
beginTransaction
validate the inputs
do all persisted object updating
exclusively lock something (an object that holds the next available id, or a simple mutex that can be accessed from a root singleton)
allocate the number
commuitTransaction
Return to “General Discussion”
Users browsing this forum: No registered users and 24 guests