RESOLVED - issue BATCH-788: Remove flush/clear from ItemWriter
Done
This commit is contained in:
@@ -70,11 +70,9 @@ public class ItemWriterChunkHandler<T> implements ChunkHandler<T> {
|
||||
}
|
||||
}
|
||||
}
|
||||
itemWriter.flush();
|
||||
}
|
||||
catch (Exception e) {
|
||||
logger.debug("Failed chunk", e);
|
||||
itemWriter.clear();
|
||||
// TODO: need to force rollback as well
|
||||
return new ChunkResponse(ExitStatus.FAILED.addExitDescription(e.getClass().getName() + ": "
|
||||
+ e.getMessage()), chunk.getJobId(), skipCount);
|
||||
|
||||
@@ -17,7 +17,7 @@ package org.springframework.batch.integration.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.batch.item.support.AbstractItemWriter;
|
||||
import org.springframework.batch.item.ItemWriter;
|
||||
import org.springframework.beans.factory.annotation.Required;
|
||||
import org.springframework.integration.channel.MessageChannel;
|
||||
import org.springframework.integration.message.GenericMessage;
|
||||
@@ -26,7 +26,7 @@ import org.springframework.integration.message.GenericMessage;
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class MessageChannelItemWriter<T> extends AbstractItemWriter<T> {
|
||||
public class MessageChannelItemWriter<T> implements ItemWriter<T> {
|
||||
|
||||
private MessageChannel channel;
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import org.junit.Test;
|
||||
import org.springframework.batch.core.SkipListener;
|
||||
import org.springframework.batch.core.listener.SkipListenerSupport;
|
||||
import org.springframework.batch.core.step.skip.AlwaysSkipItemSkipPolicy;
|
||||
import org.springframework.batch.item.support.AbstractItemWriter;
|
||||
import org.springframework.batch.item.ItemWriter;
|
||||
import org.springframework.batch.repeat.ExitStatus;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
@@ -28,7 +28,7 @@ public class ItemWriterChunkHandlerTests {
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void testVanillaHandleChunk() {
|
||||
handler.setItemWriter(new AbstractItemWriter<Object>() {
|
||||
handler.setItemWriter(new ItemWriter<Object>() {
|
||||
public void write(List<? extends Object> items) throws Exception {
|
||||
count+=items.size();
|
||||
}
|
||||
@@ -44,7 +44,7 @@ public class ItemWriterChunkHandlerTests {
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void testSetItemSkipPolicy() {
|
||||
handler.setItemWriter(new AbstractItemWriter<Object>() {
|
||||
handler.setItemWriter(new ItemWriter<Object>() {
|
||||
public void write(List<? extends Object> items) throws Exception {
|
||||
count+=items.size();
|
||||
throw new RuntimeException("Planned failure");
|
||||
@@ -62,7 +62,7 @@ public class ItemWriterChunkHandlerTests {
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void testRegisterSkipListener() {
|
||||
handler.setItemWriter(new AbstractItemWriter<Object>() {
|
||||
handler.setItemWriter(new ItemWriter<Object>() {
|
||||
public void write(List<? extends Object> items) throws Exception {
|
||||
count+=items.size();
|
||||
throw new RuntimeException("Planned failure");
|
||||
|
||||
@@ -4,11 +4,11 @@ import java.util.List;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.batch.item.support.AbstractItemWriter;
|
||||
import org.springframework.batch.item.ItemWriter;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class TestItemWriter<T> extends AbstractItemWriter<T> {
|
||||
public class TestItemWriter<T> implements ItemWriter<T> {
|
||||
|
||||
private static final Log logger = LogFactory.getLog(TestItemWriter.class);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user