재고시스템으로 알아보는 동시성이슈 해결방법 - 인프런 최상용 (1) 썸네일형 리스트형 동시성 이슈 해결방법 (Synchronized, DB Lock, Redis Lock) 문제 상황 Stock.class @Entity @NoArgsConstructor @Getter public class Stock { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private Long productId; private Long quantity; public Stock(Long productId, Long quantity) { this.productId = productId; this.quantity = quantity; } public void decrease(Long quantity) { if (this.quantity - quantity < 0) { throw new RuntimeException(".. 이전 1 다음