-
Notifications
You must be signed in to change notification settings - Fork 2.4k
GH-4703: Enhance StoppableTasklet interface to support step-specific stop requests #4715
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ | |
*/ | ||
package org.springframework.batch.core.step.tasklet; | ||
|
||
import org.springframework.batch.core.StepExecution; | ||
import org.springframework.batch.core.launch.JobOperator; | ||
|
||
/** | ||
|
@@ -28,6 +29,7 @@ | |
* so the appropriate thread safety and visibility controls should be put in place. | ||
* | ||
* @author Will Schipp | ||
* @author Hyunsang Han | ||
* @since 3.0 | ||
*/ | ||
public interface StoppableTasklet extends Tasklet { | ||
|
@@ -38,4 +40,14 @@ public interface StoppableTasklet extends Tasklet { | |
*/ | ||
void stop(); | ||
|
||
/** | ||
* Used to signal that the job should stop, providing access to the current | ||
* {@link StepExecution} context. | ||
* | ||
* @param stepExecution the current {@link StepExecution} context in which the job | ||
* is being executed | ||
*/ | ||
default void stop(StepExecution stepExecution) { | ||
stop(); | ||
} | ||
Comment on lines
+50
to
+52
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The new method provides a default implementation that delegates the call to the existing stop() method, ensuring backward compatibility for implementations that do not need step-specific stopping logic. If you have any suggestions for improvement, please feel free to provide feedback! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's great! We just need to mark the current |
||
} |