Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 30ba4e3

Browse files
Implement StoppableTasklet#stop(StepExecution) in SystemCommandTasklet
1 parent 0000909 commit 30ba4e3

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

‎spring-batch-core/src/main/java/org/springframework/batch/core/step/tasklet/SystemCommandTasklet.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
* @author Will Schipp
6262
* @author Mahmoud Ben Hassine
6363
* @author Injae Kim
64+
* @author Hyunsang Han
6465
*/
6566
public class SystemCommandTasklet implements StepExecutionListener, StoppableTasklet, InitializingBean {
6667

@@ -275,4 +276,21 @@ public void stop() {
275276
stopped = true;
276277
}
277278

279+
/**
280+
* Interrupts the execution of the system command if the given {@link StepExecution}
281+
* matches the current execution context. This method allows for granular control over
282+
* stopping specific step executions, ensuring that only the intended command is halted.
283+
*
284+
* @param stepExecution the current {@link StepExecution} context; the execution is
285+
* interrupted if it matches the ongoing one.
286+
* @since 6.0
287+
* @see StoppableTasklet#stop(StepExecution)
288+
*/
289+
@Override
290+
public void stop(StepExecution stepExecution) {
291+
if (stepExecution.equals(execution)) {
292+
stopped = true;
293+
}
294+
}
295+
278296
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /