-
Notifications
You must be signed in to change notification settings - Fork 300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[JDBC 라이브러리 구현하기 - 4단계] 성하(김성훈) 미션 제출합니다. #489
Merged
Merged
Changes from 6 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
781cc9b
refactor: Connection 파라미터로 받는 로직 삭제
sh111-coder be7d4c9
feat: TransactionSynchronizationManager 메소드 구현하여 UserService 리팩토링
sh111-coder c2492f3
test: findById 테스트 추가
sh111-coder 74682d5
test: insert 테스트 추가
sh111-coder e5c6b0d
feat: 트랜잭션 동기화 & 트랜잭션 서비스 추상화 구현
sh111-coder 797af5a
refactor: 가독성 리팩토링
sh111-coder 01be39f
refactor: bindResource, unbindResource 리팩토링
sh111-coder 90875bf
refactor: Resource unbind가 먼저 되도록 리팩토링
sh111-coder a876ec6
refactor: 파라미터 네이밍 변경
sh111-coder ae6ee43
refactor: 생성자 파라미터 구체화
sh111-coder 9ea5497
refactor: unbindResource 책임 DatasourceUtils로 위임
sh111-coder 0cde77e
refactor: 이미 존재하는 Key일 경우 먼저 예외 발생하도록 리팩토링
sh111-coder File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
현재 connectinMap에서 값을 넣고 올바르지 않으면 예외를 터트려주고있지만 잘못된 값은 map에 들어가게 되는 같아요
그래서 값을 넣기전에 먼저 검증을해주는건 어떨까요??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
해당 부분은
넣은 값이 올바르지 않으면 예외를 터트려주는 것
이 아니라넣은 값이 이미 존재한다면 예외를 터트려주는 것
으로 이해하시면 될 것 같아요!Connection mappedConnection = connectionMap.put(key, value);
에서 나오면mappedConnection은 해당 key에 해당하는 value가 존재한다면 존재하는 value를 반환하고,
key에 해당하는 value가 없다면 Map에 key, value를 넣고 null이 들어가게 됩니다!
그래서 예외를 발생시키는 이유가, 이미 ConnectionMap에 DataSource에 해당하는 Connection이 존재한다면
이미 스레드에 bind된 Resource가 있는 것이므로 예외를 발생시켰습니다!
그래서 결론적으로 put을 한 결과가 if 검증에서 필요해서 순서는 저대로 해야하는 것 같아요!