Named Business Locks – 1.Step

At the moment I’m dealing with a concurrency problem. It is not a technical problem in a multi threaded environment, but a process issue. Inside a modern software architecture where microservices are distributed across multiple physical machines, I would like to set up a locking mechanism that locks a named business object for a single access. The aim here is to protect the entire process that may run across multiple machines and services from multiple access. I call this objects Named Business Locks.

Example:

An ordering process over the Internet requires several steps for a user, which triggers subprocesses on the server. The user uses a voucher code that he redeems. The voucher expires only when the order process is completed. However, the intermediate steps on the server already require the voucher code. It’s on the Named Business Locks to prevent that the user uses the voucher code for several processes at the same time.

It’s like a transaction, where only one process can be successful at the end, but I would like to point out the user from the very beginning that the voucher code is already in progress and can only be used once.

This guardian object Named Business Lock should solve the following requirements:

  • It has to be easy to use like a mutex (lock, unlock, try_lock time_lock).
  • Locks should be recursive, and it should be cleanable.
  • There should be also a default timeout
  • The objects should be based on Databases or Files
  • The object must also be thread save.
  • It should be available in different languages (C++, C#, Javascript, Java, Phyton)

During the next months, I will try to build some libraries for different programming languages and different scenarios as described and will come back with information’s where to get the code.

 

 

Welcome

A worm welcome to my blog. On this site I write about Software Development. About things I see at my daily work, which in my oppinion others should also know,  as well as my own meanings about development trends and topics that are important to me.