Available since v4.1
One of the most common situations in distributed systems is having a shared resource: a database record, an invoice, an order, a generic aggregate root, a file, a hardware device, a log file and so on. In short, whenever it must not be possible to start modifying an entity while someone else is already modifying it, the SynchUtils Module is the solution! The SynchUtils Module (available in DMSContainer 4.1) solves every synchronization problem between distributed systems that share access to a common resource.
SynchUtils Module — key features
SynchUtils manages exclusive locks. With this kind of lock (conceptually similar to the critical sections offered by operating systems) it is easy to implement the design pattern known as the pessimistic offline lock, which prevents simultaneous updates of the resources managed by the system.
- Resources can be records, files, complex structures (graphs) or anything else that might be read and/or modified concurrently by more than one client
- SynchUtils’ exclusive locks are distributed and accessible through a convenient JSON-RPC API
- When a user wants to update a shared resource, they try to acquire a lock; if they succeed, no other user can modify the same resource until the lock is released or expires
- An advantage of the pessimistic locking model is that it avoids the conflict-resolution problem by preventing conflicts from happening in the first place
- Updates are serialized, and each subsequent update starts from the changes made by the previous user
- Provides ready-made solutions for the most common use cases and is very simple to use