Tag: partition

Spring Batch Partitioning在itemReader中注入stepExecutionContext参数

我正在尝试使用Partitioner学习Spring Batch。 问题是我需要从Partitioner实现动态设置文件名。 我试图在itemReader获取它。 但它给出了文件名null 。 我的Spring Batch配置: @Bean @StepScope public ItemReader itemReader(@Value(“#{stepExecutionContext[filename]}”) String filename) throws UnexpectedInputException, ParseException { FlatFileItemReader reader = new FlatFileItemReader(); DelimitedLineTokenizer tokenizer = new DelimitedLineTokenizer(); String[] tokens = { “username”, “userid”, “transactiondate”, “amount” }; tokenizer.setNames(tokens); reader.setResource(new ClassPathResource( “input/”+filename)); DefaultLineMapper lineMapper = new DefaultLineMapper(); lineMapper.setLineTokenizer(tokenizer); lineMapper.setFieldSetMapper(new RecordFieldSetMapper()); reader.setLinesToSkip(1); reader.setLineMapper(lineMapper); return reader; } […]

完成后,分区工作不能自行停止? 春批

我写了两个步骤的作业,其中两个步骤之一是分区步骤。 分区步骤使用TaskExecutorPartitionHandler并在线程中运行5个从属步骤。 该作业在main()方法中启动。 但是在每个从属ItemReader返回null(结束符号)之后它不会停止。 即使程序运行了main()方法中的最后一行代码(即System.out.println(“Finished”)),程序进程也不会停止,挂在内存中并且什么都不做。 我必须按下Eclipse面板上的停止按钮才能停止程序。 以下是JobLauncher.run()返回的JobExecution的内容,表示作业运行的成功状态。 JobExecution:id = 0,version = 2,startTime = Fri Nov 27 06:05:23 CST 2015,endTime = Fri Nov 27 06:05:39 CST 2015,lastUpdated = Fri Nov 27 06:05:39 CST 2015,status = COMPLETED,exitStatus = exitCode = COMPLETED; exitDescription =,job = [JobInstance:id = 0,version = 0,Job = [jobCensoredPages]],jobParameters = [{}] 7217 成品 为什么运行成功的Spring Batch程序仍然挂起? […]