Conversation
- ConcurrentHashMap 과 ThreadLocal 을 사용하여 동시성 이슈 해결
- ThreadPool 사용시를 대비하여 ThreadLocal remove 함수 추가 - 주문 수를 일반 텍스트가 아닌 변수에 저장 후 호출 방식으로 수정 - 빈줄 제거
- 지문에 `UserA 가 사과를 2개, 3개 총 2번 구매한 경우 latestOrderDatabase 에서 사과로 꺼낼 시 총 3개가 되어야 합니다.` 내용과 `latestOrderDatabase에 과일명을 key 값으로 한 것`으로 봤을때 과일별 최신 주문데이터를 저장으로 수정.
- 현재 스레드별 ThreadLocal<Map>으로 과일별 객체 관리가 불필요하여 원복함
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)
[사전 과제] 동시성 이슈 해결
작업 내용
HashMap대신에ConcurrentHashMap사용ThreadLocal을 사용하여 스레드별 독립된 저장소에 주문 데이터를 관리하도록 함발생했던 문제와 해결 과정을 남겨 주세요.
ConcurrentHashMap을 사용하여 동기화 이슈를 해결하였습니다.이번 주차에서 고민되었던 지점이나, 어려웠던 점을 알려 주세요.
리뷰 포인트
기타 질문