I have a re-occuring problem on multiple Java based projects I am involved in that would appear to be ripe to be addressed by a common design pattern.
The premise of the problem is: There is a need for concurrent data processing that requires use of a shared resource set which is persisted in a database.
The solution should: Ensure data integrity, provide high performance and ensure there are no deadlocks.
The expected behaviour is: A thread is able to query the database and to be returned the next highest priority resource and then within the same transaction is able to persist a modified state of that resource. Within the lifecycle of that thread, an additional resource is able to be persisted in certain situations.
Constraints: The current persistence technology adopted is a schemaless DB which only offers database level locking.
With the exception of the above constraint, the above problem appears to be quite a common problem so I'd appreciate knowing if there are any related enterprise/architecture design patterns which optimally solve this problem?
Also interested to know the technology stack that you would use to meet the solution requirements and expected behaviour?