Spring Batch多线程步骤执行

时间:2019-01-14 10:40:39

标签: spring spring-batch

我配置了jdbcPagingReader和JpaItemWriter。 我正在通过具有多线程任务执行程序的步骤来调用作业,

public Step step() {
        return stepBuilderFactory.get("myJob")
                .chunk(500)
                .reader(jdbcPagingItemReader)
                .writer(jpaItemWriter)
                .taskExecutor(MySimpleAsyncTaskExecutor)
                .throttleLimit(100)
                .build();
    }

但是,即使经过很长时间,我仍然看到很少的记录提交到数据库中。 我设置的页面大小等于块/提交间隔大小。

我在这里可能犯的错误是什么?。

参考日志

2019-01-14 19:08:07.257 DEBUG 3100 --- [TaskExecutor 25] o.s.batch.repeat.support.RepeatTemplate  : Repeat operation about to start at count=33
2019-01-14 19:08:07.257 DEBUG 3100 --- [TaskExecutor 79] o.s.batch.repeat.support.RepeatTemplate  : Repeat operation about to start at count=19
2019-01-14 19:08:07.257 DEBUG 3100 --- [TaskExecutor 75] o.s.batch.repeat.support.RepeatTemplate  : Repeat operation about to start at count=36
2019-01-14 19:08:07.257 DEBUG 3100 --- [TaskExecutor 49] o.s.batch.repeat.support.RepeatTemplate  : Repeat operation about to start at count=37
2019-01-14 19:08:07.257 DEBUG 3100 --- [askExecutor 100] o.s.batch.repeat.support.RepeatTemplate  : Repeat operation about to start at count=13
2019-01-14 19:08:07.257 DEBUG 3100 --- [TaskExecutor 69] o.s.batch.repeat.support.RepeatTemplate  : Repeat operation about to start at count=20
2019-01-14 19:08:07.257 DEBUG 3100 --- [TaskExecutor 72] o.s.batch.repeat.support.RepeatTemplate  : Repeat operation about to start at count=19
2019-01-14 19:08:07.257 DEBUG 3100 --- [TaskExecutor 36] o.s.batch.repeat.support.RepeatTemplate  : Repeat operation about to start at count=36
2019-01-14 19:08:07.257 DEBUG 3100 --- [-TaskExecutor 7] o.s.batch.repeat.support.RepeatTemplate  : Repeat operation about to start at count=37
2019-01-14 19:08:07.258 DEBUG 3100 --- [TaskExecutor 18] o.s.batch.repeat.support.RepeatTemplate  : Repeat operation about to start at count=72
2019-01-14 19:08:07.258 DEBUG 3100 --- [TaskExecutor 84] o.s.batch.repeat.support.RepeatTemplate  : Repeat operation about to start at count=22
2019-01-14 19:08:07.258 DEBUG 3100 --- [TaskExecutor 86] o.s.batch.repeat.support.RepeatTemplate  : Repeat operation about to start at count=20
2019-01-14 19:08:07.258 DEBUG 3100 --- [TaskExecutor 74] o.s.batch.repeat.support.RepeatTemplate  : Repeat operation about to start at count=21
2019-01-14 19:08:07.258 DEBUG 3100 --- [TaskExecutor 65] o.s.batch.repeat.support.RepeatTemplate  : Repeat operation about to start at count=39
2019-01-14 19:08:07.258 DEBUG 3100 --- [TaskExecutor 17] o.s.batch.repeat.support.RepeatTemplate  : Repeat operation about to start at count=26
2019-01-14 19:08:07.258 DEBUG 3100 --- [TaskExecutor 20] o.s.batch.repeat.support.RepeatTemplate  : Repeat operation about to start at count=22
2019-01-14 19:08:07.258 DEBUG 3100 --- [TaskExecutor 51] o.s.batch.repeat.support.RepeatTemplate  : Repeat operation about to start at count=16
2019-01-14 19:08:07.258 DEBUG 3100 --- [TaskExecutor 33] o.s.batch.repeat.support.RepeatTemplate  : Repeat operation about to start at count=14
2019-01-14 19:08:07.258 DEBUG 3100 --- [TaskExecutor 28] o.s.batch.repeat.support.RepeatTemplate  : Repeat operation about to start at count=16
2019-01-14 19:08:07.258 DEBUG 3100 --- [TaskExecutor 31] o.s.batch.repeat.support.RepeatTemplate  : Repeat operation about to start at count=26
2019-01-14 19:08:07.258 DEBUG 3100 --- [TaskExecutor 76] o.s.batch.repeat.support.RepeatTemplate  : Repeat operation about to start at count=19
2019-01-14 19:08:07.258 DEBUG 3100 --- [TaskExecutor 95] o.s.batch.repeat.support.RepeatTemplate  : Repeat operation about to start at count=11
2019-01-14 19:08:07.258 DEBUG 3100 --- [TaskExecutor 64] o.s.batch.repeat.support.RepeatTemplate  : Repeat operation about to start at count=9
2019-01-14 19:08:07.258 DEBUG 3100 --- [TaskExecutor 12] o.s.batch.repeat.support.RepeatTemplate  : Repeat operation about to start at count=10
2019-01-14 19:08:07.258 DEBUG 3100 --- [-TaskExecutor 8] o.s.batch.repeat.support.RepeatTemplate  : Repeat operation about to start at count=9
2019-01-14 19:08:07.258 DEBUG 3100 --- [-TaskExecutor 1] o.s.batch.repeat.support.RepeatTemplate  : Repeat operation about to start at count=10
2019-01-14 19:08:07.258 DEBUG 3100 --- [TaskExecutor 39] o.s.batch.repeat.support.RepeatTemplate  : Repeat operation about to start at count=10
2019-01-14 19:08:07.258 DEBUG 3100 --- [TaskExecutor 99] o.s.batch.repeat.support.RepeatTemplate  : Repeat operation about to start at count=14
2019-01-14 19:08:07.258 DEBUG 3100 --- [TaskExecutor 41] o.s.batch.repeat.support.RepeatTemplate  : Repeat operation about to start at count=8

0 个答案:

没有答案