本文整理汇总了Java中javax.batch.operations.JobOperator.restart方法的典型用法代码示例。如果您正苦于以下问题:Java JobOperator.restart方法的具体用法?Java JobOperator.restart怎么用?Java JobOperator.restart使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.batch.operations.JobOperator
的用法示例。
在下文中一共展示了JobOperator.restart方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testDeciderRestart
import javax.batch.operations.JobOperator; //导入方法依赖的package包/类
@Test
public void testDeciderRestart() {
JobOperator jobOperator = BatchRuntime.getJobOperator();
long executionId = jobOperator.start("decider-test", new Properties());
BatchStatus batchStatus = Batches.waitFor(jobOperator, executionId);
assertEquals(batchStatus, BatchStatus.STOPPED);
assertEquals(jobOperator.getJobExecution(executionId).getExitStatus(), "decider-stop");
List<StepExecution> stepExecutions = jobOperator.getStepExecutions(executionId);
assertEquals(stepExecutions.size(), 1);
long restartExecutionId = jobOperator.restart(executionId, new Properties());
BatchStatus restartStatus = Batches.waitFor(jobOperator, restartExecutionId);
assertEquals(restartStatus, BatchStatus.COMPLETED);
String exitStatus = jobOperator.getJobExecution(restartExecutionId).getExitStatus();
assertEquals("COMPLETED", exitStatus);
List<StepExecution> restartExecutions = jobOperator.getStepExecutions(restartExecutionId);
assertEquals(restartExecutions.size(), 1);
assertEquals(restartExecutions.get(0).getStepName(), "executeOnRestart");
}
示例2: testRestartBadExecutionId
import javax.batch.operations.JobOperator; //导入方法依赖的package包/类
@Test
public void testRestartBadExecutionId() throws Exception {
boolean seen1 = false;
JobOperator jo = BatchRuntime.getJobOperator();
long exec1Id = jo.start("alwaysFails1", null);
try {
jo.restart(Long.MAX_VALUE, null);
} catch (NoSuchJobExecutionException e) {
seen1 = true;
}
if (!seen1) throw new IllegalStateException("FAIL");
}
示例3: testBatchExecutionWithCheckpoints
import javax.batch.operations.JobOperator; //导入方法依赖的package包/类
@Test
public void testBatchExecutionWithCheckpoints() {
final JobOperator op = BatchRuntime.getJobOperator();
final long id = op.start("checkpoint-storage-test", null);
Batches.waitForEnd(op, id);
final List<StepExecution> steps = op.getStepExecutions(id);
assertEquals(1, steps.size());
final StepExecution exec = steps.iterator().next();
Assert.assertEquals(BatchStatus.FAILED, exec.getBatchStatus());
// now try to restart the batch again
long restartId = op.restart(id, null);
Batches.waitForEnd(op, restartId);
}
示例4: doStart
import javax.batch.operations.JobOperator; //导入方法依赖的package包/类
@Override
protected long doStart(final JobOperator operator) {
final long nid = operator.restart(id, toProperties(properties));
info("Batch " + nid + " restarted with id #" + nid);
return nid;
}