Add bookmyshow module: seat booking with hold expiry and payment timeout, naive vs pessimistic vs optimistic inventories, race and deadlock demos, JDBC strategies on H2 (8 test classes, 8 transcripts)

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b5YFRisPHrLBR2dRu9
This commit is contained in:
asmhatre
2026-11-17 01:03:44 +05:30
co-authored by Claude Sonnet 5.5
parent deb924febd
commit c57031aaeb
42 changed files with 2322 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
NaiveInventory: two users request seat C5 at the same moment (barrier forces both reads before either write)
====================================================================================================
holds granted for C5: 2 (a seat can only be sold once)
both users now pay:
outcomes (sorted): [CONFIRMED, HOLD_LOST_AFTER_PAYMENT]
customers charged: 2
customers refunded: 1
C5 in the end: BOOKED by BK-000x v3
Neither thread did anything unusual. Each ran check, then act, and the barrier only decided
that both checks finished before either act began.
PessimisticInventory, same two users at the same moment:
holds granted for C5: 1
loser sees: SeatUnavailableException
OptimisticInventory, same two users at the same moment:
holds granted for C5: 1
loser sees: SeatUnavailableException