Removed the close() method from ItemWriter - it shadows ItemStream so use that interface if needed.
This commit is contained in:
@@ -287,8 +287,4 @@ public class HibernateAwareItemWriter implements ItemWriter, RepeatInterceptor,
|
||||
|
||||
}
|
||||
|
||||
public void close() throws Exception {
|
||||
delegate.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -38,10 +38,4 @@ public interface ItemWriter {
|
||||
*/
|
||||
public void write(Object item) throws Exception;
|
||||
|
||||
/**
|
||||
* Close the writer, allowing all allocated resources to be cleaned up.
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
void close() throws Exception;
|
||||
}
|
||||
|
||||
@@ -26,6 +26,4 @@ import org.springframework.batch.item.ItemWriter;
|
||||
*/
|
||||
public abstract class AbstractItemWriter implements ItemWriter{
|
||||
|
||||
public void close() throws Exception {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,9 +53,4 @@ public class DelegatingItemWriter implements ItemWriter, Skippable, Initializing
|
||||
Assert.notNull(writer);
|
||||
}
|
||||
|
||||
// YODO: remove
|
||||
public void close() throws Exception {
|
||||
writer.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -51,32 +51,5 @@ public class CompositeItemWriterTests extends TestCase {
|
||||
control.verify();
|
||||
}
|
||||
}
|
||||
|
||||
public void testClose() throws Exception {
|
||||
|
||||
final int NUMBER_OF_PROCESSORS = 10;
|
||||
|
||||
List processors = new ArrayList(NUMBER_OF_PROCESSORS);
|
||||
final List list = new ArrayList(NUMBER_OF_PROCESSORS);
|
||||
|
||||
for (int i = 0; i < NUMBER_OF_PROCESSORS; i++) {
|
||||
ItemWriter processor = new AbstractItemWriter() {
|
||||
public void write(Object item) throws Exception {
|
||||
throw new IllegalStateException("No way!");
|
||||
}
|
||||
public void close() throws Exception {
|
||||
list.add(this);
|
||||
}
|
||||
};
|
||||
processor.close();
|
||||
processors.add(processor);
|
||||
}
|
||||
|
||||
itemProcessor.setDelegates(processors);
|
||||
itemProcessor.close();
|
||||
|
||||
assertEquals(NUMBER_OF_PROCESSORS, list.size());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user