我有使用以下代码从控制器同步启动的spring批处理作业:
SimpleJobLauncher jobLauncher = new SimpleJobLauncher();
jobLauncher.setJobRepository(jobRepository.getObject());
jobLauncher.setTaskExecutor(new SyncTaskExecutor());
jobLauncher.run(convertFileJob, new JobParametersBuilder().addDate("date", new Date()).toJobParameters());
每当作业失败时,整个应用程序都会关闭。
INFO 7 --- [Thread-22] o.s.i.endpoint.EventDrivenConsumer : Removing {logging-channel-adapter:_org.springframework.integration.errorLogger} as a subscriber to the 'errorChannel' channel
INFO 7 --- [Thread-22] o.s.i.channel.PublishSubscribeChannel : Channel 'application.errorChannel' has 0 subscriber(s).
INFO 7 --- [Thread-22] o.s.i.endpoint.EventDrivenConsumer : stopped _org.springframework.integration.errorLogger
INFO 7 --- [Thread-22] o.s.s.c.ThreadPoolTaskScheduler : Shutting down ExecutorService 'taskScheduler'
INFO 7 --- [Thread-22] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor'
INFO 7 --- [Thread-22] o.e.jetty.server.AbstractConnector : Stopped ServerConnector@29be997f{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}
INFO 7 --- [Thread-22] org.eclipse.jetty.server.session : node0 Stopped scavenging
INFO 7 --- [Thread-22] o.e.j.s.h.ContextHandler.application : Destroying Spring FrameworkServlet 'dispatcherServlet'
INFO 7 --- [Thread-22] o.e.jetty.server.handler.ContextHandler : Stopped o.s.b.w.e.j.JettyEmbeddedWebAppContext@3ab6678b{application,/,[file:///tmp/jetty-docbase.3907062630090555365.8080/],UNAVAILABLE}
如何防止这种行为?
谢谢!
答案 0 :(得分:0)
这是我的错误,我运行了调试器,发现正在使用的库中调用了System.exit(-1)
。