InventoryService.java
1// ❌ VULNERABLE CODE (The "Double Buy" Bug)2public void checkout(Long id, int qty) {3 Product product = repository.findById(id).get(); // Read45 if (product.getStock() >= qty) {6 product.setStock(product.getStock() - qty); // Modify7 repository.save(product); // Save8 }9}10// Problem: Between 'Read' and 'Save', another thread11// can change the data!
Simulation Console
> Status: System Ready
> Strategy: vulnerable
Awaiting execution trigger.
Success Rate0%
Requests
5,000
Lost Sales
0