Commit e0cf590
committed
Improve
1. Message payload not always be `Set`, if you return payload directly, you will see tests failed:
```
[main] ERROR org.springframework.batch.core.step.AbstractStep - Encountered an error executing step step1-manager in job job1
java.lang.ClassCastException: class java.util.ArrayList cannot be cast to class java.util.Set (java.util.ArrayList and java.util.Set are in module java.base of loader 'bootstrap')
at org.springframework.batch.integration.partition.MessageChannelPartitionHandler.receiveReplies(MessageChannelPartitionHandler.java:298)
at org.springframework.batch.integration.partition.MessageChannelPartitionHandler.doHandle(MessageChannelPartitionHandler.java:244)
at org.springframework.batch.core.partition.support.AbstractPartitionHandler.handle(AbstractPartitionHandler.java:60)
at org.springframework.batch.core.partition.support.PartitionStep.doExecute(PartitionStep.java:102)
at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:230)
at org.springframework.batch.core.job.SimpleStepHandler.handleStep(SimpleStepHandler.java:153)
at org.springframework.batch.core.job.flow.JobFlowExecutor.executeStep(JobFlowExecutor.java:68)
at org.springframework.batch.core.job.flow.support.state.StepState.handle(StepState.java:68)
at org.springframework.batch.core.job.flow.support.SimpleFlow.resume(SimpleFlow.java:165)
at org.springframework.batch.core.job.flow.support.SimpleFlow.start(SimpleFlow.java:140)
at org.springframework.batch.core.job.flow.FlowJob.doExecute(FlowJob.java:132)
at org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:307)
at org.springframework.batch.core.launch.support.TaskExecutorJobLauncher$1.run(TaskExecutorJobLauncher.java:155)
at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:50)
at org.springframework.batch.core.launch.support.TaskExecutorJobLauncher.run(TaskExecutorJobLauncher.java:146)
at org.springframework.batch.integration.partition.VanillaIntegrationTests.testLaunchJob(VanillaIntegrationTests.java:58)
```
2. No need to create a new `HashSet` if payload is `Set` since no modifications applied to it.
Signed-off-by: Yanming Zhou <[email protected]>MessageChannelPartitionHandler::receiveReplies
1 parent 961734b commit e0cf590
File tree
1 file changed
+6
-3
lines changed- spring-batch-integration/src/main/java/org/springframework/batch/integration/partition
1 file changed
+6
-3
lines changedLines changed: 6 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
83 | 84 | | |
84 | 85 | | |
85 | 86 | | |
| 87 | + | |
86 | 88 | | |
87 | 89 | | |
88 | 90 | | |
| |||
286 | 288 | | |
287 | 289 | | |
288 | 290 | | |
289 | | - | |
| 291 | + | |
290 | 292 | | |
291 | 293 | | |
292 | 294 | | |
| |||
296 | 298 | | |
297 | 299 | | |
298 | 300 | | |
299 | | - | |
| 301 | + | |
| 302 | + | |
300 | 303 | | |
301 | 304 | | |
302 | 305 | | |
| |||
0 commit comments