fix: EgovMyBatisBatchItemWriter의 사용되지 않는 reflection 루프 제거#238
Open
z3rotig4r wants to merge 1 commit into
Open
Conversation
write()가 chunk의 각 item에 대해 BeanInfo/PropertyDescriptor 기반 reflection으로 파라미터 Map을 생성하여 List에 모았으나, 이 결과는 어디에도 사용되지 않고 super.write(chunk)가 원본 chunk로 호출되어 전량 폐기되고 있었습니다. 대용량 배치 write 경로에서 chunk마다 item별 Introspector.getBeanInfo + getPropertyDescriptors + getter 호출이 불필요하게 수행되므로, 결과가 사용되지 않는 죽은 코드를 제거했습니다. super.write 동작은 동일하게 유지됩니다. 검증: EgovMybatisTest(본 writer로 DB update step 포함 Job 실행) 통과. 참고: 위 Map은 본래 공유 변수를 statement 파라미터에 주입하려던 의도로 보이나 실제로는 배선되지 않아 동작하지 않습니다. 변수 주입 기능 복구는 별도 이슈로 추적합니다.
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.
개요
EgovMyBatisBatchItemWriter.write(Chunk)가 chunk의 각 item에 대해 reflection으로 파라미터Map을 만들어List에 모으지만, 그 결과를 전혀 사용하지 않고 폐기하고 있어 제거합니다.문제
list/map은 메서드 지역 변수이며super.write(chunk)는 원본 chunk로 호출됩니다. 즉 위 루프의 산출물은 어디에도 전달되지 않고 전량 폐기됩니다(dead code).Introspector.getBeanInfo+getPropertyDescriptors+ 모든 getter 호출(reader.invoke)이 불필요하게 수행됩니다.변경
결과가 사용되지 않는 reflection 루프와, 그로 인해 순수 위임만 남는
write오버라이드를 제거했습니다. 더 이상 필요 없는 import도 함께 정리했습니다. 제거 후에는 부모MyBatisBatchItemWriter.write가 그대로 사용되어 동작은 동일합니다.검증
EgovMybatisTest(본 writer로 DB update step을 포함한 Job을 실행하는 통합 테스트)가 변경 후에도 통과합니다(BUILD SUCCESS). 이는 제거된 코드가 실제 동작에 기여하지 않았음을 확인해 줍니다.참고
위
Map은 본래 공유 변수(EgovResourceVariable/EgovJobVariableListener/EgovStepVariableListener)를 statement 파라미터에 주입하려던 의도로 보이나, 실제로는 배선되지 않아 동작하지 않습니다(reader 쪽EgovMyBatisPagingItemReader는setParameterValues로 정상 동작). 본 PR은 죽은 코드 제거에 한정하며, 변수 주입 기능 복구는 별도 이슈로 제안합니다.