Skip to content

Commit

Permalink
Implement StoppableTasklet#stop(StepExecution) in SystemCommandTasklet
Browse files Browse the repository at this point in the history
  • Loading branch information
HyunSangHan committed Nov 24, 2024
1 parent b640caa commit c9365d3
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
* @author Will Schipp
* @author Mahmoud Ben Hassine
* @author Injae Kim
* @author Hyunsang Han
*/
public class SystemCommandTasklet implements StepExecutionListener, StoppableTasklet, InitializingBean {

Expand Down Expand Up @@ -275,4 +276,21 @@ public void stop() {
stopped = true;
}

/**
* Interrupts the execution of the system command if the given {@link StepExecution}
* matches the current execution context. This method allows for granular control over
* stopping specific step executions, ensuring that only the intended command is halted.
*
* @param stepExecution the current {@link StepExecution} context; the execution is
* interrupted if it matches the ongoing one.
* @since 6.0
* @see StoppableTasklet#stop(StepExecution)
*/
@Override
public void stop(StepExecution stepExecution) {
if (stepExecution.getId().equals(execution.getId())) {
stopped = true;
}
}

}

0 comments on commit c9365d3

Please sign in to comment.