Twitter

luni, 8 august 2016

Inventory optimistic locking with retry feature via db-util (Spring Data+Hibernate JPA)

This application is a test of handling an inventory when concurrent updates leads to optimistic locking exceptions via retry feature provided by Vlad Mihalcea in his db-util library  (in Spring: org.springframework.orm.ObjectOptimisticLockingFailureException). For more details, you should read the How to retry a JPA transactions after an OptimisticLockException article.

Test case possible output (inventory contains initially a quantity of 8 t-shirts, there are 10 buyers who order a random number of t-shirts between 1-4, and 10 retries for each buyer optimistic locking exception):

Niciun comentariu:

Trimiteți un comentariu