Conversation
Close the flow executor when transition lookup fails and keep the step execution holder local to each executor while preserving thread isolation. Add JDBC-backed regression coverage for restart, unrelated job execution, exceptional cleanup, and executor isolation. Fixes spring-projects#5514 Signed-off-by: 郑朝钦 <1357598741@qq.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When no transition matches a step's exit status,
SimpleFlow.nextState()throws outside the block that closes the executor. The staticJobFlowExecutorholder can then expose the failed step to a subsequent job execution on the same thread, which may mark itABANDONEDand prevent restart.This change closes the executor when transition lookup fails and scopes the thread-local holder to each executor. Thread isolation within an executor is preserved for parallel flows.
Four JDBC-backed regression tests cover preserving another job's persisted step status and version, restarting after an unmatched transition, exceptional cleanup, and isolation between executors. The new tests fail against the original implementation and pass with this change.
Fixes #5514
Validation on Windows with JDK 25:
6.1.0-SNAPSHOT, re-runs the failed step, preserves the first job'sFAILEDstatus after another job runs, and no longer produces the stale-copy optimistic locking failure. The catch-all control still behaves correctly.The full
mvn installattempt stopped at two failures in the unchanged infrastructure module:AbstractFileItemWriterTests.testFailedFileDeletionThrowsExceptionandStaxEventItemWriterTests.testFailedFileDeletionThrowsException. Both stubFile.delete(), while the implementations callFiles.delete(). A follow-up all-moduletestrun with-Dmaven.test.failure.ignore=truereported only these same two failures; the core, test-support, and integration modules had no failures. The full integration/functional suite has not passed locally.