-
카테고리
-
세부 분야
백엔드
-
해결 여부
미해결
ItemStream.update 관련
21.11.30 19:33 작성 조회수 169
0
9:46초경 ItemStream 프로세스 관련
- ItemStream.update() 메서드가 Chunk size만큼 반복된다고 나와 있는데
- TaskletStep의 doExecute() 메서드에서는 반복문 바깥에 stream.update() 메서드가 호출되어서 1번만 호출되는 것 같습니다
@Override
protected void doExecute(StepExecution stepExecution) throws Exception {
stepExecution.getExecutionContext().put(TASKLET_TYPE_KEY, tasklet.getClass().getName());
stepExecution.getExecutionContext().put(STEP_TYPE_KEY, this.getClass().getName());
stream.update(stepExecution.getExecutionContext());
getJobRepository().updateExecutionContext(stepExecution);
// Shared semaphore per step execution, so other step executions can run
// in parallel without needing the lock
final Semaphore semaphore = createSemaphore();
답변을 작성해보세요.
0
정수원
지식공유자2021.12.05
네
강의를 보시면 ItemReader 와 ItemWriter 가 chunkSize 만큼의 데이터 처리를 한 후 ItemStream.update() 가 실행된다고 설명하고 있습니다.
즉 ItemStream.update() 가 chunkSize 만큼 반복된다는 것이 아니라 chunkSize 단위로 실행된다고 보시면 됩니다.
예를 들어 chunkSize 가 10 이라고 한다면 ItemReader 가 10개의 데이터를 읽은 후 ItemStream.update() 가 발생하고 ItemWriter 가 10 개의 데이터가 담은 list 를 커밋한 후 ItemStream.update() 가 실행된다는 의미입니다.
답변 1