RESOLVED - BATCH-963: ExecutionContext modifications in ItemStream.close(ExecutionContext) are not persisted
removed ExecutionContext argument from ItemStream.close() signature
This commit is contained in:
@@ -47,8 +47,6 @@ public interface ItemStream {
|
||||
/**
|
||||
* If any resources are needed for the stream to operate they need to be destroyed here. Once this method has been
|
||||
* called all other methods (except open) may throw an exception.
|
||||
*
|
||||
* @param executionContext the current execution context in case it is needed
|
||||
*/
|
||||
void close(ExecutionContext executionContext) throws ItemStreamException;
|
||||
void close() throws ItemStreamException;
|
||||
}
|
||||
|
||||
@@ -26,9 +26,9 @@ public abstract class ItemStreamSupport implements ItemStream {
|
||||
|
||||
/**
|
||||
* No-op.
|
||||
* @see org.springframework.batch.item.ItemStream#close(ExecutionContext)
|
||||
* @see org.springframework.batch.item.ItemStream#close()
|
||||
*/
|
||||
public void close(ExecutionContext executionContext) throws ItemStreamException {
|
||||
public void close() throws ItemStreamException {
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -126,7 +126,7 @@ public class DrivingQueryItemReader<T> implements ItemReader<T>, InitializingBea
|
||||
* Close the resource by setting the list of keys to null, allowing them to
|
||||
* be garbage collected.
|
||||
*/
|
||||
public void close(ExecutionContext executionContext) {
|
||||
public void close() {
|
||||
initialized = false;
|
||||
currentIndex = 0;
|
||||
keysIterator = null;
|
||||
|
||||
@@ -181,7 +181,7 @@ public class JdbcCursorItemReader<T> extends AbstractItemCountingItemStreamItemR
|
||||
handleWarnings(preparedStatement);
|
||||
}
|
||||
catch (SQLException se) {
|
||||
close(null);
|
||||
close();
|
||||
throw getExceptionTranslator().translate("Executing query", sql, se);
|
||||
}
|
||||
|
||||
|
||||
@@ -200,9 +200,9 @@ public class FlatFileItemWriter<T> extends ExecutionContextUserSupport implement
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ItemStream#close(ExecutionContext)
|
||||
* @see ItemStream#close()
|
||||
*/
|
||||
public void close(ExecutionContext executionContext) {
|
||||
public void close() {
|
||||
if (state != null) {
|
||||
try {
|
||||
if (footerCallback != null) {
|
||||
|
||||
@@ -95,7 +95,7 @@ public class MultiResourceItemReader<T> implements ItemReader<T>, ItemStream {
|
||||
return null;
|
||||
}
|
||||
|
||||
delegate.close(new ExecutionContext());
|
||||
delegate.close();
|
||||
delegate.setResource(resources[index.currentResource]);
|
||||
delegate.open(new ExecutionContext());
|
||||
|
||||
@@ -109,9 +109,9 @@ public class MultiResourceItemReader<T> implements ItemReader<T>, ItemStream {
|
||||
* Close the {@link #setDelegate(ResourceAwareItemReaderItemStream)} reader
|
||||
* and reset instance variable values.
|
||||
*/
|
||||
public void close(ExecutionContext executionContext) throws ItemStreamException {
|
||||
public void close() throws ItemStreamException {
|
||||
index = new MultiResourceIndex();
|
||||
delegate.close(new ExecutionContext());
|
||||
delegate.close();
|
||||
noInput = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ public class MultiResourceItemWriter<T> extends ExecutionContextUserSupport impl
|
||||
|
||||
public void write(List<? extends T> items) throws Exception {
|
||||
if (currentResourceItemCount >= itemCountLimitPerResource) {
|
||||
delegate.close(new ExecutionContext());
|
||||
delegate.close();
|
||||
resourceIndex++;
|
||||
currentResourceItemCount = 0;
|
||||
setResourceToDelegate();
|
||||
@@ -101,10 +101,10 @@ public class MultiResourceItemWriter<T> extends ExecutionContextUserSupport impl
|
||||
this.saveState = saveState;
|
||||
}
|
||||
|
||||
public void close(ExecutionContext executionContext) throws ItemStreamException {
|
||||
public void close() throws ItemStreamException {
|
||||
resourceIndex = 1;
|
||||
currentResourceItemCount = 0;
|
||||
delegate.close(executionContext);
|
||||
delegate.close();
|
||||
}
|
||||
|
||||
public void open(ExecutionContext executionContext) throws ItemStreamException {
|
||||
|
||||
@@ -69,7 +69,7 @@ public abstract class AbstractItemCountingItemStreamItemReader<T> implements Ite
|
||||
this.currentItemCount = count;
|
||||
}
|
||||
|
||||
public void close(ExecutionContext executionContext) throws ItemStreamException {
|
||||
public void close() throws ItemStreamException {
|
||||
currentItemCount = 0;
|
||||
try {
|
||||
doClose();
|
||||
|
||||
@@ -80,10 +80,10 @@ public class CompositeItemStream implements ItemStream {
|
||||
* Broadcast the call to close.
|
||||
* @throws ItemStreamException
|
||||
*/
|
||||
public void close(ExecutionContext executionContext) throws ItemStreamException {
|
||||
public void close() throws ItemStreamException {
|
||||
synchronized (streams) {
|
||||
for (ItemStream itemStream : streams) {
|
||||
itemStream.close(executionContext);
|
||||
itemStream.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -374,9 +374,9 @@ public class StaxEventItemWriter<T> extends ExecutionContextUserSupport implemen
|
||||
/**
|
||||
* Flush and close the output source.
|
||||
*
|
||||
* @see org.springframework.batch.item.ItemStream#close(ExecutionContext)
|
||||
* @see org.springframework.batch.item.ItemStream#close()
|
||||
*/
|
||||
public void close(ExecutionContext executionContext) {
|
||||
public void close() {
|
||||
|
||||
// harmless event to close the root tag if there were no items
|
||||
XMLEventFactory factory = XMLEventFactory.newInstance();
|
||||
|
||||
Reference in New Issue
Block a user