我是春季批次新手,对暂停/恢复有一些疑问。阅读弹簧批文档后,似乎没有任何内置的暂停或恢复功能。但是,我从主站点找到了这个用例:
http://docs.spring.io/spring-batch/2.0.x/cases/pause.html
没有提供样品代码,或者我可以在哪里找到这些样品?
在Spring批处理中,我了解内置了一个停止和重启功能。我可以用它作为暂停和恢复的形式吗?或者还有另一种更好的方法吗?
答案 0 :(得分:3)
停止/重启基本上是暂停和恢复。它允许您以编程方式停止正在运行的作业并从中断处继续。
答案 1 :(得分:0)
为此使用作业运算符,它是提供诸如stop,restart,getStatus之类的功能的基本接口。
public interface JobOperator {
List<Long> getExecutions(long instanceId) throws NoSuchJobInstanceException;
List<Long> getJobInstances(String jobName, int start, int count)
throws NoSuchJobException;
Set<Long> getRunningExecutions(String jobName) throws NoSuchJobException;
String getParameters(long executionId) throws NoSuchJobExecutionException;
Long start(String jobName, String parameters)
throws NoSuchJobException, JobInstanceAlreadyExistsException;
Long restart(long executionId)
throws JobInstanceAlreadyCompleteException, NoSuchJobExecutionException,
NoSuchJobException, JobRestartException;
Long startNextInstance(String jobName)
throws NoSuchJobException, JobParametersNotFoundException, JobRestartException,
JobExecutionAlreadyRunningException, JobInstanceAlreadyCompleteException;
boolean stop(long executionId)
throws NoSuchJobExecutionException, JobExecutionNotRunningException;
String getSummary(long executionId) throws NoSuchJobExecutionException;
Map<Long, String> getStepExecutionSummaries(long executionId)
throws NoSuchJobExecutionException;
Set<String> getJobNames();
}
这是一个例子