Skip to content

Commit 2fbb3f1

Browse files
committed
JBERET-446 Batch restart does not process steps
1 parent 7bd72dd commit 2fbb3f1

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

jberet-core/src/main/java/org/jberet/_private/BatchMessages.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,4 +204,7 @@ public interface BatchMessages {
204204
@Message(id = 656, value = "Invalid batch property expression: %s")
205205
IllegalArgumentException invalidPropertyExpression(String propertyExpression);
206206

207+
@Message(id = 657, value = "Could not find the restart position %s in job %s")
208+
BatchRuntimeException couldNotFindRestartPoint(String restartPoint, String jobName);
209+
207210
}

jberet-core/src/main/java/org/jberet/runtime/runner/CompositeExecutionRunner.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013 Red Hat, Inc. and/or its affiliates.
2+
* Copyright (c) 2013-2018 Red Hat, Inc. and/or its affiliates.
33
*
44
* This program and the accompanying materials are made
55
* available under the terms of the Eclipse Public License 2.0
@@ -48,33 +48,41 @@ protected void runFromHeadOrRestartPoint(final String restartPoint) {
4848
//clear the restart point passed over from original job execution. This execution may have its own
4949
//restart point or null (start from head) for use by the next restart.
5050
jobContext.getJobExecution().setRestartPosition(null);
51+
boolean restartPointFound = false;
5152
for (final JobElement e : getJobElements()) {
5253
if (e instanceof Step) {
5354
final Step step = (Step) e;
5455
if (step.getId().equals(restartPoint)) {
56+
restartPointFound = true;
5557
runStep(step);
5658
break;
5759
}
5860
} else if (e instanceof Flow) {
5961
final Flow flow = (Flow) e;
6062
if (flow.getId().equals(restartPoint)) {
63+
restartPointFound = true;
6164
runFlow(flow, null);
6265
break;
6366
}
6467
} else if (e instanceof Split) {
6568
final Split split = (Split) e;
6669
if (split.getId().equals(restartPoint)) {
70+
restartPointFound = true;
6771
runSplit(split);
6872
break;
6973
}
7074
} else if (e instanceof Decision) {
7175
final Decision decision = (Decision) e;
7276
if (decision.getId().equals(restartPoint)) {
77+
restartPointFound = true;
7378
runDecision(decision);
7479
break;
7580
}
7681
}
7782
}
83+
if (!restartPointFound) {
84+
throw BatchMessages.MESSAGES.couldNotFindRestartPoint(restartPoint, jobContext.getJobName());
85+
}
7886
} else {
7987
// the head of the composite job element is the first non-abstract element (step, flow, or split)
8088
for (final JobElement e : getJobElements()) {

0 commit comments

Comments
 (0)