BATCH-2283: Updated MessageChannelPartitionHandler to return null when no partitions are specified
This commit is contained in:
@@ -32,7 +32,7 @@ public class AsyncItemWriter<T> implements ItemWriter<Future<T>>, InitializingBe
|
||||
}
|
||||
|
||||
/**
|
||||
* @param delegate
|
||||
* @param delegate ItemWriter that does the actual writing of the Future results
|
||||
*/
|
||||
public void setDelegate(ItemWriter<T> delegate) {
|
||||
this.delegate = delegate;
|
||||
|
||||
@@ -31,8 +31,8 @@ public class JobLaunchRequest {
|
||||
private final JobParameters jobParameters;
|
||||
|
||||
/**
|
||||
* @param job
|
||||
* @param jobParameters
|
||||
* @param job job to be launched
|
||||
* @param jobParameters parameters to run the job with
|
||||
*/
|
||||
public JobLaunchRequest(Job job, JobParameters jobParameters) {
|
||||
super();
|
||||
|
||||
@@ -57,7 +57,7 @@ public class JobLaunchingGateway extends AbstractReplyProducingMessageHandler {
|
||||
* is a failure to start the job. The cause of the exception will be a
|
||||
* {@link JobExecutionException}.
|
||||
*
|
||||
* @throws MessageHandlingException
|
||||
* @throws MessageHandlingException when a job cannot be launched
|
||||
*/
|
||||
@Override
|
||||
protected Object handleRequestMessage(Message<?> requestMessage) {
|
||||
|
||||
@@ -35,7 +35,7 @@ public class JobLaunchingMessageHandler implements JobLaunchRequestHandler {
|
||||
private final JobLauncher jobLauncher;
|
||||
|
||||
/**
|
||||
* @param jobLauncher
|
||||
* @param jobLauncher {@link org.springframework.batch.core.launch.JobLauncher} used to execute Spring Batch jobs
|
||||
*/
|
||||
public JobLaunchingMessageHandler(JobLauncher jobLauncher) {
|
||||
super();
|
||||
|
||||
@@ -18,6 +18,7 @@ import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.messaging.PollableChannel;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@@ -119,6 +120,11 @@ public class MessageChannelPartitionHandler implements PartitionHandler {
|
||||
StepExecution masterStepExecution) throws Exception {
|
||||
|
||||
Set<StepExecution> split = stepExecutionSplitter.split(masterStepExecution, gridSize);
|
||||
|
||||
if(CollectionUtils.isEmpty(split)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
int count = 0;
|
||||
|
||||
if (replyChannel == null) {
|
||||
|
||||
Reference in New Issue
Block a user