Grokking Spring Boot
0% completed
Pessimistic Locking
Suppose the booking service sells event 7 with the optimistic locking from the previous lesson. Every time two customers race for one seat, the loser's card is charged before the conflict is found at commit. The support team then refunds each of those customers, who saw a charge and then an error.
The data is never wrong in that design. The conflict is simply found after the most expensive step, the payment. To find it earlier, Ben's request must stop as soon as it reads a seat that Ana is booking.
That is what a pessimistic lock does
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%