SystemExtr()中的Spring批处理

时间:2014-04-08 18:26:14

标签: java spring-batch-admin

我正在研究SpringBatch CommandLineJobRunner。我想从单一工作中运行多个工作。这是我的代码。我的代码还可以,但是如果 CommandLineJobRunner.presetSystemExiter(新的SystemExiter()不包含它只运行一个作业并且不能提供多个作业,我不会在下面。所以请解释我这是如何工作的。

 CommandLineJobRunner.presetSystemExiter( new SystemExiter() 
                  { 
                        public void exit( int status ) 
                        {
                    }
                  });

  String[] params1 = { jobConfig1, jobID1, "runId=" + new Date().getTime() };
  CommandLineJobRunner.main(params1);

  String[] params2 = { jobConfig2, jobID2, "runId=" + new Date().getTime() };
  CommandLineJobRunner.main(params2);

非常感谢。

1 个答案:

答案 0 :(得分:0)

简而言之:默认的exiter只是调用JVM System.exit()来终止你的JVM。

此处详细说明: http://www.dotkam.com/2011/03/15/spring-batch-commandlinejobrunner-to-run-multiple-jobs/