RESOLVED - issue BATCH-1022: Chunk is not serializable but is wrapped by a Serializable ChunkRequest
This commit is contained in:
@@ -19,6 +19,7 @@ package org.springframework.batch.integration.chunk;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.batch.core.StepContribution;
|
||||
import org.springframework.batch.core.step.item.Chunk;
|
||||
import org.springframework.batch.core.step.item.ChunkProcessor;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.integration.annotation.MessageEndpoint;
|
||||
@@ -62,7 +63,7 @@ public class ChunkProcessorChunkHandler<S> implements ChunkHandler<S>, Initializ
|
||||
|
||||
StepContribution stepContribution = chunkRequest.getStepContribution();
|
||||
try {
|
||||
chunkProcessor.process(stepContribution, chunkRequest.getChunk());
|
||||
chunkProcessor.process(stepContribution, new Chunk<S>(chunkRequest.getItems()));
|
||||
}
|
||||
catch (Exception e) {
|
||||
logger.debug("Failed chunk", e);
|
||||
|
||||
@@ -20,16 +20,15 @@ import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.springframework.batch.core.StepContribution;
|
||||
import org.springframework.batch.core.step.item.Chunk;
|
||||
|
||||
public class ChunkRequest<T> implements Serializable {
|
||||
|
||||
private final Long jobId;
|
||||
private final Chunk<T> items;
|
||||
private final Collection<? extends T> items;
|
||||
private final StepContribution stepContribution;
|
||||
|
||||
public ChunkRequest(Collection<? extends T> items, Long jobId, StepContribution stepContribution) {
|
||||
this.items = new Chunk<T>(items);
|
||||
this.items = items;
|
||||
this.jobId = jobId;
|
||||
this.stepContribution = stepContribution;
|
||||
}
|
||||
@@ -38,7 +37,7 @@ public class ChunkRequest<T> implements Serializable {
|
||||
return jobId;
|
||||
}
|
||||
|
||||
public Chunk<T> getChunk() {
|
||||
public Collection<? extends T> getItems() {
|
||||
return items;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user