작성
·
357
1
안녕하세요 강사님.
테스트가 진행하다가 멈춰버리네요.
강사님 강의에는 전파전략이 있고 깃헙에는 또 없으신데... 어느게 맞는건가 싶기도 합니다...
https://github.com/dkaskgkdua/stock
제 깃헙에 저장된 소스입니다.
답변 5
3
mj Song 님 안녕하세요
깃헙에 올려주신 소스를 확인해봤는데
@Transactional(propagation = Propagation.REQUEST_NEW) 옵션을 facade 에 붙여주셨더라고요..!
facade 에 있는 @Transactional 을 StockService 로 옮기시고 StockService 에 붙어있는 Synchronized 를 삭제하시면 되실겁니다.
이렇게해도 안되시면 다시한번 답글 달아주세요!!
0
0
0
로그를 확인하니 재고가 32개까지만 딱 줄고 그 뒤로는 멈추는거 같습니다
마지막 락 제거하고가 딱 끝이네요
Hibernate: update stock set product_id=?, quantity=?, version=? where id=? and version=?
2022-09-05 20:25:09.683 TRACE 16044 --- [ool-1-thread-19] o.h.type.descriptor.sql.BasicBinder : binding parameter [1] as [BIGINT] - [1]
2022-09-05 20:25:09.683 TRACE 16044 --- [ool-1-thread-19] o.h.type.descriptor.sql.BasicBinder : binding parameter [2] as [BIGINT] - [33]
2022-09-05 20:25:09.683 TRACE 16044 --- [ool-1-thread-19] o.h.type.descriptor.sql.BasicBinder : binding parameter [3] as [BIGINT] - [67]
2022-09-05 20:25:09.683 TRACE 16044 --- [ool-1-thread-19] o.h.type.descriptor.sql.BasicBinder : binding parameter [4] as [BIGINT] - [1]
2022-09-05 20:25:09.683 TRACE 16044 --- [ool-1-thread-19] o.h.type.descriptor.sql.BasicBinder : binding parameter [5] as [BIGINT] - [66]
2022-09-05 20:25:09.686 DEBUG 16044 --- [ool-1-thread-19] org.hibernate.SQL : select release_lock(?)
Hibernate: select release_lock(?)
2022-09-05 20:25:09.686 TRACE 16044 --- [ool-1-thread-19] o.h.type.descriptor.sql.BasicBinder : binding parameter [1] as [VARCHAR] - [1]
2022-09-05 20:25:09.700 DEBUG 16044 --- [ool-1-thread-19] org.hibernate.SQL : select get_lock(?, 3000)
Hibernate: select get_lock(?, 3000)
2022-09-05 20:25:09.700 TRACE 16044 --- [ool-1-thread-19] o.h.type.descriptor.sql.BasicBinder : binding parameter [1] as [VARCHAR] - [1]
2022-09-05 20:25:09.702 DEBUG 16044 --- [ool-1-thread-19] org.hibernate.SQL : select stock0_.id as id1_0_0_, stock0_.product_id as product_2_0_0_, stock0_.quantity as quantity3_0_0_, stock0_.version as version4_0_0_ from stock stock0_ where stock0_.id=?
Hibernate: select stock0_.id as id1_0_0_, stock0_.product_id as product_2_0_0_, stock0_.quantity as quantity3_0_0_, stock0_.version as version4_0_0_ from stock stock0_ where stock0_.id=?
2022-09-05 20:25:09.702 TRACE 16044 --- [ool-1-thread-19] o.h.type.descriptor.sql.BasicBinder : binding parameter [1] as [BIGINT] - [1]
2022-09-05 20:25:09.705 DEBUG 16044 --- [ool-1-thread-19] org.hibernate.SQL : update stock set product_id=?, quantity=?, version=? where id=? and version=?
Hibernate: update stock set product_id=?, quantity=?, version=? where id=? and version=?
2022-09-05 20:25:09.705 TRACE 16044 --- [ool-1-thread-19] o.h.type.descriptor.sql.BasicBinder : binding parameter [1] as [BIGINT] - [1]
2022-09-05 20:25:09.705 TRACE 16044 --- [ool-1-thread-19] o.h.type.descriptor.sql.BasicBinder : binding parameter [2] as [BIGINT] - [32]
2022-09-05 20:25:09.705 TRACE 16044 --- [ool-1-thread-19] o.h.type.descriptor.sql.BasicBinder : binding parameter [3] as [BIGINT] - [68]
2022-09-05 20:25:09.705 TRACE 16044 --- [ool-1-thread-19] o.h.type.descriptor.sql.BasicBinder : binding parameter [4] as [BIGINT] - [1]
2022-09-05 20:25:09.706 TRACE 16044 --- [ool-1-thread-19] o.h.type.descriptor.sql.BasicBinder : binding parameter [5] as [BIGINT] - [67]
2022-09-05 20:25:09.707 DEBUG 16044 --- [ool-1-thread-19] org.hibernate.SQL : select release_lock(?)
Hibernate: select release_lock(?)
2022-09-05 20:25:09.708 TRACE 16044 --- [ool-1-thread-19] o.h.type.descriptor.sql.BasicBinder : binding parameter [1] as [VARCHAR] - [1]
0
mj Song 님 안녕하세요.
어느부분을 수행하다가 멈추시는지 알려주실 수 있으실까요 ?
전파전략이 있는건 named lock 부분이 맞을까요 ?
맞다면 전파전략이 있는것이 맞습니다.
깃헙에는 최종본 소스가 올라가있기때문에 상이한것 같습니다.
감사합니다.