Open
Conversation
- OrderInfo 클래스를 생성하여 주문 정보를 불변 객체로 관리하도록 구현했습니다. - OrderService 클래스에서 productDatabase의 자료 구조를 HashMap에서 ConcurrentHashMap으로 변경하였습니다. - OrderService 클래스의 order 메서드에서 ConcurrentHashMap의 compute 함수를 활용하여 재고 조회 및 업데이트를 원자적으로 처리하도록 수정했습니다. - JUnit을 사용하여 OrderService의 동시성 처리 로직을 검증하는 단위 테스트를 작성하였습니다.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
제목(title)
작업 내용
(1) OrderInfo 클래스 추가
(2) OrderService 클래스 추가
(3) OrderServiceTest 클래스 추가
발생했던 문제와 해결 과정을 남겨 주세요.
문제 1
해결 1
이번 주차에서 고민되었던 지점이나, 어려웠던 점을 알려 주세요.
리뷰 포인트
동시성 처리 로직 검토: OrderService 클래스 내에서 ConcurrentHashMap과 ThreadLocal을 활용한 동시성 제어 로직이 올바르게 구현되었는지 확인 부탁드립니다.
ThreadLocal 데이터 정리: 스레드 풀 환경에서의 ThreadLocal 데이터 정리가 제대로 이루어지고 있는지 검토 부탁드립니다.
기타 질문
(1) 현업에서는 이와 유사한 동시성 문제를 어떻게 해결하고 있나요?
(2) 스레드 풀 환경에서 ThreadLocal을 사용할 때 주의해야 할 점은 무엇인가요?