BATCH-365: ItemStream#Update and ItemStream#close now accept an ExecutionContext as an argument. I removed the local ExecutionContexts in the readers and readers, and had them use the passed in ones instead.
This commit is contained in:
@@ -81,9 +81,9 @@ public class HibernateCursorItemReader extends AbstractItemStreamItemReader impl
|
||||
|
||||
private boolean initialized = false;
|
||||
|
||||
private ExecutionContext executionContext = new ExecutionContext();
|
||||
|
||||
private String name = HibernateCursorItemReader.class.getName();
|
||||
|
||||
private boolean saveState = false;
|
||||
|
||||
public Object read() {
|
||||
if (!initialized) {
|
||||
@@ -109,7 +109,7 @@ public class HibernateCursorItemReader extends AbstractItemStreamItemReader impl
|
||||
/**
|
||||
* Closes the result set cursor and hibernate session.
|
||||
*/
|
||||
public void close() {
|
||||
public void close(ExecutionContext executionContext) {
|
||||
initialized = false;
|
||||
cursor.close();
|
||||
currentProcessedRow = 0;
|
||||
@@ -127,8 +127,6 @@ public class HibernateCursorItemReader extends AbstractItemStreamItemReader impl
|
||||
* Creates cursor for the query.
|
||||
*/
|
||||
public void open(ExecutionContext executionContext) {
|
||||
this.executionContext = executionContext;
|
||||
|
||||
Assert.state(!initialized, "Cannot open an already opened ItemReader, call close first");
|
||||
|
||||
if (useStatelessSession) {
|
||||
@@ -187,10 +185,13 @@ public class HibernateCursorItemReader extends AbstractItemStreamItemReader impl
|
||||
|
||||
/**
|
||||
*/
|
||||
public void update() {
|
||||
executionContext.putString(getKey(RESTART_DATA_ROW_NUMBER_KEY), "" + currentProcessedRow);
|
||||
String skipped = skippedRows.toString();
|
||||
executionContext.putString(getKey(SKIPPED_ROWS), skipped.substring(1, skipped.length() - 1));
|
||||
public void update(ExecutionContext executionContext) {
|
||||
if(saveState){
|
||||
Assert.notNull(executionContext, "ExecutionContext must not be null");
|
||||
executionContext.putString(getKey(RESTART_DATA_ROW_NUMBER_KEY), "" + currentProcessedRow);
|
||||
String skipped = skippedRows.toString();
|
||||
executionContext.putString(getKey(SKIPPED_ROWS), skipped.substring(1, skipped.length() - 1));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -238,4 +239,8 @@ public class HibernateCursorItemReader extends AbstractItemStreamItemReader impl
|
||||
private String getKey(String key){
|
||||
return name + "." + key;
|
||||
}
|
||||
|
||||
public void setSaveState(boolean saveState) {
|
||||
this.saveState = saveState;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,8 +155,6 @@ public class JdbcCursorItemReader implements KeyedItemReader, InitializingBean,
|
||||
|
||||
private boolean initialized = false;
|
||||
|
||||
private ExecutionContext executionContext = new ExecutionContext();
|
||||
|
||||
private boolean saveState = false;
|
||||
|
||||
private String name = JdbcCursorItemReader.class.getName();
|
||||
@@ -269,9 +267,9 @@ public class JdbcCursorItemReader implements KeyedItemReader, InitializingBean,
|
||||
* will be closed. This must be called or the connection and cursor will be
|
||||
* held open indefinitely!
|
||||
*
|
||||
* @see org.springframework.batch.item.ResourceLifecycle#close()
|
||||
* @see org.springframework.batch.item.ResourceLifecycle#close(ExecutionContext)
|
||||
*/
|
||||
public void close() {
|
||||
public void close(ExecutionContext executionContext) {
|
||||
initialized = false;
|
||||
JdbcUtils.closeResultSet(this.rs);
|
||||
JdbcUtils.closeStatement(this.stmt);
|
||||
@@ -312,7 +310,7 @@ public class JdbcCursorItemReader implements KeyedItemReader, InitializingBean,
|
||||
handleWarnings(this.stmt.getWarnings());
|
||||
}
|
||||
catch (SQLException se) {
|
||||
close();
|
||||
close(null);
|
||||
throw getExceptionTranslator().translate("Executing query", sql, se);
|
||||
}
|
||||
|
||||
@@ -385,8 +383,9 @@ public class JdbcCursorItemReader implements KeyedItemReader, InitializingBean,
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.batch.item.stream.ItemStreamAdapter#getExecutionContext()
|
||||
*/
|
||||
public void update() {
|
||||
public void update(ExecutionContext executionContext) {
|
||||
if(saveState){
|
||||
Assert.notNull(executionContext, "ExecutionContext must not be null");
|
||||
String skipped = skippedRows.toString();
|
||||
executionContext.putString(addName(SKIPPED_ROWS), skipped.substring(1, skipped.length() - 1));
|
||||
executionContext.putLong(addName(CURRENT_PROCESSED_ROW), currentProcessedRow);
|
||||
@@ -404,7 +403,6 @@ public class JdbcCursorItemReader implements KeyedItemReader, InitializingBean,
|
||||
Assert.notNull(context, "ExecutionContext must not be null");
|
||||
executeQuery();
|
||||
initialized = true;
|
||||
this.executionContext = context;
|
||||
|
||||
// Properties restartProperties = data.getProperties();
|
||||
if (!context.containsKey(addName(CURRENT_PROCESSED_ROW))) {
|
||||
|
||||
@@ -61,8 +61,6 @@ public class DrivingQueryItemReader implements KeyedItemReader, InitializingBean
|
||||
|
||||
private KeyGenerator keyGenerator;
|
||||
|
||||
private ExecutionContext executionContext = new ExecutionContext();
|
||||
|
||||
private boolean saveState = false;
|
||||
|
||||
public DrivingQueryItemReader() {
|
||||
@@ -119,7 +117,7 @@ public class DrivingQueryItemReader implements KeyedItemReader, InitializingBean
|
||||
* Close the resource by setting the list of keys to null, allowing them to
|
||||
* be garbage collected.
|
||||
*/
|
||||
public void close() {
|
||||
public void close(ExecutionContext executionContext) {
|
||||
initialized = false;
|
||||
currentIndex = 0;
|
||||
lastCommitIndex = 0;
|
||||
@@ -143,11 +141,11 @@ public class DrivingQueryItemReader implements KeyedItemReader, InitializingBean
|
||||
keys = keyGenerator.retrieveKeys(executionContext);
|
||||
keysIterator = keys.listIterator();
|
||||
initialized = true;
|
||||
this.executionContext = executionContext;
|
||||
}
|
||||
|
||||
public void update() {
|
||||
public void update(ExecutionContext executionContext) {
|
||||
if(saveState){
|
||||
Assert.notNull(executionContext, "ExecutionContext must not be null");
|
||||
if(getCurrentKey() != null){
|
||||
keyGenerator.saveState(getCurrentKey(), executionContext);
|
||||
}
|
||||
|
||||
@@ -93,9 +93,7 @@ public class FlatFileItemReader implements ItemReader, Skippable, ItemStream, In
|
||||
private LineTokenizer tokenizer = new DelimitedLineTokenizer();
|
||||
|
||||
private FieldSetMapper fieldSetMapper;
|
||||
|
||||
private ExecutionContext executionContext = new ExecutionContext();
|
||||
|
||||
|
||||
private String name = FlatFileItemReader.class.getName();
|
||||
|
||||
/**
|
||||
@@ -112,8 +110,6 @@ public class FlatFileItemReader implements ItemReader, Skippable, ItemStream, In
|
||||
|
||||
Assert.state(resource.exists(), "Resource must exist: [" + resource + "]");
|
||||
|
||||
this.executionContext = executionContext;
|
||||
|
||||
log.debug("Opening flat file for reading: " + resource);
|
||||
|
||||
if (this.reader == null) {
|
||||
@@ -161,11 +157,11 @@ public class FlatFileItemReader implements ItemReader, Skippable, ItemStream, In
|
||||
* Close and null out the reader.
|
||||
* @throws Exception
|
||||
*/
|
||||
public void close() throws StreamException {
|
||||
public void close(ExecutionContext executionContext) throws StreamException {
|
||||
try {
|
||||
if (reader != null) {
|
||||
log.debug("Closing flat file for reading: " + resource);
|
||||
reader.close();
|
||||
reader.close(null);
|
||||
}
|
||||
}
|
||||
finally {
|
||||
@@ -202,10 +198,11 @@ public class FlatFileItemReader implements ItemReader, Skippable, ItemStream, In
|
||||
* the current Line Count which can be used to reinitialise the batch job in
|
||||
* case of restart.
|
||||
*/
|
||||
public void update() {
|
||||
public void update(ExecutionContext executionContext) {
|
||||
if (reader == null) {
|
||||
throw new StreamException("ItemStream not open or already closed.");
|
||||
}
|
||||
Assert.notNull(executionContext, "ExecutionContext must not be null");
|
||||
executionContext.putLong(getKey(READ_STATISTICS_NAME), reader.getPosition());
|
||||
executionContext.putLong(getKey(SKIPPED_STATISTICS_NAME), skippedLines.size());
|
||||
}
|
||||
|
||||
@@ -79,8 +79,6 @@ public class FlatFileItemWriter extends AbstractTransactionalIoSource implements
|
||||
|
||||
private Resource resource;
|
||||
|
||||
private ExecutionContext executionContext = new ExecutionContext();
|
||||
|
||||
private OutputState state = null;
|
||||
|
||||
private LineAggregator lineAggregator = new DelimitedLineAggregator();
|
||||
@@ -149,9 +147,9 @@ public class FlatFileItemWriter extends AbstractTransactionalIoSource implements
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ResourceLifecycle#close()
|
||||
* @see ResourceLifecycle#close(ExecutionContext)
|
||||
*/
|
||||
public void close() {
|
||||
public void close(ExecutionContext executionContext) {
|
||||
if (state != null) {
|
||||
getOutputState().close();
|
||||
state = null;
|
||||
@@ -184,7 +182,6 @@ public class FlatFileItemWriter extends AbstractTransactionalIoSource implements
|
||||
* @see ResourceLifecycle#open()
|
||||
*/
|
||||
public void open(ExecutionContext executionContext) {
|
||||
this.executionContext = executionContext;
|
||||
OutputState outputState = getOutputState();
|
||||
if(executionContext.containsKey(getKey(RESTART_DATA_NAME))){
|
||||
outputState.restoreFrom(executionContext);
|
||||
@@ -192,12 +189,13 @@ public class FlatFileItemWriter extends AbstractTransactionalIoSource implements
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ItemStream#update()
|
||||
* @see ItemStream#update(ExecutionContext)
|
||||
*/
|
||||
public void update() {
|
||||
public void update(ExecutionContext executionContext) {
|
||||
if (state == null) {
|
||||
throw new StreamException("ItemStream not open or already closed.");
|
||||
}
|
||||
Assert.notNull(executionContext, "ExecutionContext must not be null");
|
||||
executionContext.putLong(getKey(RESTART_DATA_NAME), state.position());
|
||||
executionContext.putLong(getKey(WRITTEN_STATISTICS_NAME), state.linesWritten);
|
||||
executionContext.putLong(getKey(RESTART_COUNT_STATISTICS_NAME), state.restartCount);
|
||||
|
||||
@@ -26,6 +26,7 @@ import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.springframework.batch.io.exception.BatchEnvironmentException;
|
||||
import org.springframework.batch.item.ExecutionContext;
|
||||
import org.springframework.batch.item.ItemReader;
|
||||
import org.springframework.batch.item.ItemStream;
|
||||
import org.springframework.batch.item.exception.MarkFailedException;
|
||||
@@ -169,11 +170,11 @@ public class ResourceLineReader extends ItemStreamSupport implements LineReader,
|
||||
/**
|
||||
* Close the reader associated with this input source.
|
||||
*
|
||||
* @see org.springframework.batch.io.ItemReader#close()
|
||||
* @see org.springframework.batch.io.ItemReader#close(ExecutionContext)
|
||||
* @throws BatchEnvironmentException if there is an {@link IOException}
|
||||
* during the close operation.
|
||||
*/
|
||||
public synchronized void close() {
|
||||
public synchronized void close(ExecutionContext executionContext) {
|
||||
if (state == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -61,8 +61,8 @@ public class StaxEventItemReader extends AbstractItemReader implements ItemReade
|
||||
|
||||
private List skipRecords = new ArrayList();
|
||||
|
||||
private ExecutionContext executionContext = new ExecutionContext();
|
||||
|
||||
private boolean saveState = false;
|
||||
|
||||
/**
|
||||
* Read in the next root element from the file, and return it.
|
||||
*
|
||||
@@ -90,7 +90,7 @@ public class StaxEventItemReader extends AbstractItemReader implements ItemReade
|
||||
return item;
|
||||
}
|
||||
|
||||
public void close() {
|
||||
public void close(ExecutionContext executionContext) {
|
||||
initialized = false;
|
||||
if (fragmentReader == null && inputStream == null) {
|
||||
return;
|
||||
@@ -113,8 +113,7 @@ public class StaxEventItemReader extends AbstractItemReader implements ItemReade
|
||||
|
||||
public void open(ExecutionContext executionContext) {
|
||||
Assert.state(resource.exists(), "Input resource does not exist: [" + resource + "]");
|
||||
this.executionContext = executionContext;
|
||||
|
||||
|
||||
try {
|
||||
inputStream = resource.getInputStream();
|
||||
txReader = new DefaultTransactionalEventReader(XMLInputFactory.newInstance().createXMLEventReader(
|
||||
@@ -193,26 +192,13 @@ public class StaxEventItemReader extends AbstractItemReader implements ItemReade
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ItemStream#update()
|
||||
* @see ItemStream#update(ExecutionContext)
|
||||
*/
|
||||
public void update() {
|
||||
executionContext.putLong(READ_COUNT_STATISTICS_NAME, currentRecordCount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Restores the input source for the given restart data by rereading and
|
||||
* skipping the number of records stored in the {@link ExecutionContext}.
|
||||
*
|
||||
* @param ExecutionContext that holds the line count from the last
|
||||
* commit.
|
||||
* @throws IllegalStateException if the ItemReader has already been
|
||||
* initialized or if the number of records to read and skip exceeds the
|
||||
* available records.
|
||||
*/
|
||||
public void restoreFrom(ExecutionContext data) {
|
||||
|
||||
|
||||
|
||||
public void update(ExecutionContext executionContext) {
|
||||
if(saveState){
|
||||
Assert.notNull(executionContext, "ExecutionContext must not be null");
|
||||
executionContext.putLong(READ_COUNT_STATISTICS_NAME, currentRecordCount);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -273,4 +259,7 @@ public class StaxEventItemReader extends AbstractItemReader implements ItemReade
|
||||
fragmentReader.reset();
|
||||
}
|
||||
|
||||
public void setSaveState(boolean saveState) {
|
||||
this.saveState = saveState;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,8 +101,10 @@ public class StaxEventItemWriter implements ItemWriter, ItemStream, Initializing
|
||||
// current count of processed records
|
||||
private long currentRecordCount = 0;
|
||||
|
||||
private ExecutionContext executionContext = new ExecutionContext();
|
||||
|
||||
private String name = StaxEventItemWriter.class.getName();
|
||||
|
||||
private boolean saveState = false;
|
||||
|
||||
/**
|
||||
* Set output file.
|
||||
*
|
||||
@@ -223,13 +225,12 @@ public class StaxEventItemWriter implements ItemWriter, ItemStream, Initializing
|
||||
* @see org.springframework.batch.item.ResourceLifecycle#open()
|
||||
*/
|
||||
public void open(ExecutionContext executionContext) {
|
||||
this.executionContext = executionContext;
|
||||
long startAtPosition = 0;
|
||||
|
||||
// if restart data is provided, restart from provided offset
|
||||
// otherwise start from beginning
|
||||
if (executionContext.containsKey(RESTART_DATA_NAME)) {
|
||||
startAtPosition = executionContext.getLong(RESTART_DATA_NAME);
|
||||
if (executionContext.containsKey(getKey(RESTART_DATA_NAME))) {
|
||||
startAtPosition = executionContext.getLong(getKey(RESTART_DATA_NAME));
|
||||
restarted = true;
|
||||
}
|
||||
|
||||
@@ -330,9 +331,9 @@ public class StaxEventItemWriter implements ItemWriter, ItemStream, Initializing
|
||||
/**
|
||||
* Close the output source.
|
||||
*
|
||||
* @see org.springframework.batch.item.ResourceLifecycle#close()
|
||||
* @see org.springframework.batch.item.ResourceLifecycle#close(ExecutionContext)
|
||||
*/
|
||||
public void close() {
|
||||
public void close(ExecutionContext executionContext) {
|
||||
initialized = false;
|
||||
try {
|
||||
endDocument(delegateEventWriter);
|
||||
@@ -365,14 +366,18 @@ public class StaxEventItemWriter implements ItemWriter, ItemStream, Initializing
|
||||
|
||||
/**
|
||||
* Get the restart data.
|
||||
* @see org.springframework.batch.item.ItemStream#update()
|
||||
* @see org.springframework.batch.item.ItemStream#update(ExecutionContext)
|
||||
*/
|
||||
public void update() {
|
||||
public void update(ExecutionContext executionContext) {
|
||||
if (!initialized) {
|
||||
throw new StreamException("ItemStream is not open, or may have been closed. Cannot access context.");
|
||||
}
|
||||
executionContext.putLong(RESTART_DATA_NAME, getPosition());
|
||||
executionContext.putLong(WRITE_STATISTICS_NAME, currentRecordCount);
|
||||
|
||||
if(saveState){
|
||||
Assert.notNull(executionContext, "ExecutionContext must not be null");
|
||||
executionContext.putLong(getKey(RESTART_DATA_NAME), getPosition());
|
||||
executionContext.putLong(getKey(WRITE_STATISTICS_NAME), currentRecordCount);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -432,12 +437,24 @@ public class StaxEventItemWriter implements ItemWriter, ItemStream, Initializing
|
||||
public void clear() throws ClearFailedException {
|
||||
currentRecordCount = lastCommitPointRecordCount;
|
||||
// close output
|
||||
close();
|
||||
close(null);
|
||||
// and reopen it - we do this because we need to reopen stream
|
||||
// reader at specified position - calling setPosition() is not
|
||||
// enough!
|
||||
restarted = true;
|
||||
open(lastCommitPointPosition);
|
||||
}
|
||||
|
||||
public void setSaveState(boolean saveState) {
|
||||
this.saveState = saveState;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
private String getKey(String key){
|
||||
return name + "." + key;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -35,20 +35,23 @@ public interface ItemStream {
|
||||
*
|
||||
* @throws IllegalArgumentException if context is null
|
||||
*/
|
||||
void open(ExecutionContext context) throws StreamException;
|
||||
void open(ExecutionContext executionContext) throws StreamException;
|
||||
|
||||
/**
|
||||
* Indicates that the execution context provided during open
|
||||
* is about to be saved. If any state is remaining, but
|
||||
* has not been put in the context, it should be added
|
||||
* here.
|
||||
* @param executionContext to be updated
|
||||
* @throws IllegalArgumentException if executionContext is null.
|
||||
*/
|
||||
void update();
|
||||
void update(ExecutionContext executionContext);
|
||||
|
||||
/**
|
||||
* 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 TODO
|
||||
*/
|
||||
void close() throws StreamException;
|
||||
void close(ExecutionContext executionContext) throws StreamException;
|
||||
}
|
||||
|
||||
@@ -50,13 +50,13 @@ public class DelegatingItemReader extends AbstractItemReader implements Skippabl
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ItemStream#update()
|
||||
* @see ItemStream#update(ExecutionContext)
|
||||
* @throws IllegalStateException if the parent template is not itself
|
||||
* {@link ItemStream}.
|
||||
*/
|
||||
public void update() {
|
||||
public void update(ExecutionContext executionContext) {
|
||||
if (itemReader instanceof ItemStream) {
|
||||
((ItemStream) itemReader).update();
|
||||
((ItemStream) itemReader).update(executionContext);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,9 +95,9 @@ public class DelegatingItemReader extends AbstractItemReader implements Skippabl
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.batch.item.ItemStream#open()
|
||||
*/
|
||||
public void close() throws StreamException {
|
||||
public void close(ExecutionContext executionContext) throws StreamException {
|
||||
if (itemReader instanceof ItemStream) {
|
||||
((ItemStream) itemReader).close();
|
||||
((ItemStream) itemReader).close(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.batch.item.reader;
|
||||
|
||||
import org.springframework.batch.item.ExecutionContext;
|
||||
import org.springframework.batch.item.ItemReader;
|
||||
import org.springframework.batch.item.exception.MarkFailedException;
|
||||
import org.springframework.batch.item.exception.ResetFailedException;
|
||||
@@ -40,7 +41,7 @@ public class ItemReaderAdapter extends AbstractMethodInvokingDelegator implement
|
||||
/**
|
||||
* Do nothing.
|
||||
*
|
||||
* @see org.springframework.batch.item.ItemReader#close()
|
||||
* @see org.springframework.batch.item.ItemReader#close(ExecutionContext)
|
||||
*/
|
||||
public void close() throws StreamException {
|
||||
|
||||
|
||||
@@ -29,9 +29,9 @@ public class ItemStreamSupport implements ItemStream {
|
||||
|
||||
/**
|
||||
* No-op.
|
||||
* @see org.springframework.batch.item.ItemStream#close()
|
||||
* @see org.springframework.batch.item.ItemStream#close(ExecutionContext)
|
||||
*/
|
||||
public void close() throws StreamException {
|
||||
public void close(ExecutionContext executionContext) throws StreamException {
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -43,9 +43,9 @@ public class ItemStreamSupport implements ItemStream {
|
||||
|
||||
/**
|
||||
* Return empty {@link ExecutionContext}.
|
||||
* @see org.springframework.batch.item.ExecutionContextProvider#update()
|
||||
* @see org.springframework.batch.item.ExecutionContextProvider#update(ExecutionContext)
|
||||
*/
|
||||
public void update() {
|
||||
public void update(ExecutionContext executionContext) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -68,11 +68,11 @@ public class SimpleStreamManager implements StreamManager {
|
||||
*
|
||||
* @see org.springframework.batch.item.stream.StreamManager#getExecutionContext(java.lang.Object)
|
||||
*/
|
||||
public void update() {
|
||||
public void update(ExecutionContext executionContext) {
|
||||
synchronized (streams) {
|
||||
for (Iterator it = streams.iterator(); it.hasNext();) {
|
||||
ItemStream itemStream = (ItemStream) it.next();
|
||||
itemStream.update();
|
||||
itemStream.update(executionContext);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -96,11 +96,11 @@ public class SimpleStreamManager implements StreamManager {
|
||||
* Broadcast the call to close from this {@link StreamManager}.
|
||||
* @throws StreamException
|
||||
*/
|
||||
public void close() throws StreamException {
|
||||
public void close(ExecutionContext executionContext) throws StreamException {
|
||||
synchronized (streams) {
|
||||
for (Iterator it = streams.iterator(); it.hasNext();) {
|
||||
ItemStream itemStream = (ItemStream) it.next();
|
||||
itemStream.close();
|
||||
itemStream.close(executionContext);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ public interface StreamManager {
|
||||
* @return {@link ExecutionContext} aggregating the contexts of all providers
|
||||
* registered under this key, or empty otherwise.
|
||||
*/
|
||||
void update();
|
||||
void update(ExecutionContext executionContext);
|
||||
|
||||
/**
|
||||
* If any resources are needed for the stream to operate they need to be
|
||||
@@ -58,7 +58,7 @@ public interface StreamManager {
|
||||
* @param key the key under which {@link ItemStream} instances might have
|
||||
* been registered.
|
||||
*/
|
||||
void close() throws StreamException;
|
||||
void close(ExecutionContext executionContext) throws StreamException;
|
||||
|
||||
/**
|
||||
* If any resources are needed for the stream to operate they need to be
|
||||
|
||||
@@ -75,17 +75,17 @@ public class DelegatingItemWriter implements ItemWriter, ItemStream, Initializin
|
||||
|
||||
/**
|
||||
* @throws StreamException
|
||||
* @see org.springframework.batch.item.ItemStream#close()
|
||||
* @see org.springframework.batch.item.ItemStream#close(ExecutionContext)
|
||||
*/
|
||||
public void close() throws StreamException {
|
||||
stream.close();
|
||||
public void close(ExecutionContext executionContext) throws StreamException {
|
||||
stream.close(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.springframework.batch.item.ExecutionContextProvider#update()
|
||||
* @see org.springframework.batch.item.ExecutionContextProvider#update(ExecutionContext)
|
||||
*/
|
||||
public void update() {
|
||||
stream.update();
|
||||
public void update(ExecutionContext executionContext) {
|
||||
stream.update(executionContext);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -31,6 +31,7 @@ public class HibernateCursorItemReaderIntegrationTests extends AbstractDataSourc
|
||||
inputSource.setSessionFactory(sessionFactory);
|
||||
inputSource.setUseStatelessSession(isUseStatelessSession());
|
||||
inputSource.afterPropertiesSet();
|
||||
inputSource.setSaveState(true);
|
||||
|
||||
return inputSource;
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ public class DrivingQueryItemReaderTests extends TestCase {
|
||||
Foo foo2 = (Foo) itemReader.read();
|
||||
assertEquals(2, foo2.getValue());
|
||||
|
||||
getAsItemStream(itemReader).update();
|
||||
getAsItemStream(itemReader).update(executionContext);
|
||||
|
||||
// create new input source
|
||||
itemReader = createItemReader();
|
||||
@@ -104,7 +104,7 @@ public class DrivingQueryItemReaderTests extends TestCase {
|
||||
Foo foo2 = (Foo) itemReader.read();
|
||||
assertEquals(2, foo2.getValue());
|
||||
|
||||
getAsItemStream(itemReader).update();
|
||||
getAsItemStream(itemReader).update(executionContext);
|
||||
|
||||
// create new input source
|
||||
itemReader = createItemReader();
|
||||
|
||||
@@ -29,12 +29,12 @@ class FooItemReader extends AbstractItemReader implements ItemStream, ItemReader
|
||||
}
|
||||
}
|
||||
|
||||
public void update() {
|
||||
inputSource.update();
|
||||
public void update(ExecutionContext executionContext) {
|
||||
inputSource.update(executionContext);
|
||||
}
|
||||
|
||||
public void destroy() throws Exception {
|
||||
inputSource.close();
|
||||
inputSource.close(null);
|
||||
}
|
||||
|
||||
public void setFooDao(FooDao fooDao) {
|
||||
@@ -48,7 +48,7 @@ class FooItemReader extends AbstractItemReader implements ItemStream, ItemReader
|
||||
inputSource.open(executionContext);
|
||||
};
|
||||
|
||||
public void close() {
|
||||
public void close(ExecutionContext executionContext) {
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -74,7 +74,7 @@ public class FlatFileItemReaderAdvancedTests extends TestCase {
|
||||
* Release resources and delete the temporary file
|
||||
*/
|
||||
protected void tearDown() throws Exception {
|
||||
reader.close();
|
||||
reader.close(null);
|
||||
}
|
||||
|
||||
private Resource getInputResource(String input) {
|
||||
@@ -87,7 +87,7 @@ public class FlatFileItemReaderAdvancedTests extends TestCase {
|
||||
*/
|
||||
public void testSkip() throws Exception {
|
||||
|
||||
reader.close();
|
||||
reader.close(null);
|
||||
reader.setResource(getInputResource("testLine1\ntestLine2\ntestLine3\ntestLine4\ntestLine5\ntestLine6"));
|
||||
reader.open(executionContext);
|
||||
|
||||
@@ -122,7 +122,7 @@ public class FlatFileItemReaderAdvancedTests extends TestCase {
|
||||
*/
|
||||
public void testSkipFirstChunk() throws Exception {
|
||||
|
||||
reader.close();
|
||||
reader.close(null);
|
||||
reader.setResource(getInputResource("testLine1\ntestLine2\ntestLine3\ntestLine4\ntestLine5\ntestLine6"));
|
||||
reader.open(executionContext);
|
||||
|
||||
@@ -145,7 +145,7 @@ public class FlatFileItemReaderAdvancedTests extends TestCase {
|
||||
|
||||
public void testRestart() throws Exception {
|
||||
|
||||
reader.close();
|
||||
reader.close(null);
|
||||
reader.setResource(getInputResource("testLine1\ntestLine2\ntestLine3\ntestLine4\ntestLine5\ntestLine6"));
|
||||
reader.open(executionContext);
|
||||
|
||||
@@ -159,11 +159,11 @@ public class FlatFileItemReaderAdvancedTests extends TestCase {
|
||||
reader.read();
|
||||
|
||||
// get restart data
|
||||
reader.update();
|
||||
reader.update(executionContext);
|
||||
assertEquals(4, executionContext.getLong(
|
||||
FlatFileItemReader.class.getName() + "." + FlatFileItemReader.READ_STATISTICS_NAME));
|
||||
// close input
|
||||
reader.close();
|
||||
reader.close(executionContext);
|
||||
|
||||
reader.setResource(getInputResource("testLine1\ntestLine2\ntestLine3\ntestLine4\ntestLine5\ntestLine6"));
|
||||
|
||||
@@ -174,7 +174,7 @@ public class FlatFileItemReaderAdvancedTests extends TestCase {
|
||||
assertEquals("[testLine5]", reader.read().toString());
|
||||
assertEquals("[testLine6]", reader.read().toString());
|
||||
|
||||
reader.update();
|
||||
reader.update(executionContext);
|
||||
assertEquals(6, executionContext.getLong(FlatFileItemReader.class.getName() + "." + FlatFileItemReader.READ_STATISTICS_NAME));
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ public class FlatFileItemReaderBasicTests extends TestCase {
|
||||
* Release resources.
|
||||
*/
|
||||
protected void tearDown() throws Exception {
|
||||
itemReader.close();
|
||||
itemReader.close(null);
|
||||
}
|
||||
|
||||
private Resource getInputResource(String input) {
|
||||
@@ -159,7 +159,7 @@ public class FlatFileItemReaderBasicTests extends TestCase {
|
||||
itemReader = new FlatFileItemReader();
|
||||
itemReader.setResource(getInputResource(TEST_STRING));
|
||||
itemReader.setFieldSetMapper(fieldSetMapper);
|
||||
itemReader.close();
|
||||
itemReader.close(null);
|
||||
// The open does not happen automatically on a read...
|
||||
itemReader.open(executionContext);
|
||||
assertEquals("[FlatFileInputTemplate-TestData]", itemReader.read().toString());
|
||||
|
||||
@@ -82,7 +82,7 @@ public class FlatFileItemWriterTests extends TestCase {
|
||||
if (reader != null) {
|
||||
reader.close();
|
||||
}
|
||||
inputSource.close();
|
||||
inputSource.close(null);
|
||||
outputFile.delete();
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ public class FlatFileItemWriterTests extends TestCase {
|
||||
public void testWriteString() throws Exception {
|
||||
inputSource.open(executionContext);
|
||||
inputSource.write(TEST_STRING);
|
||||
inputSource.close();
|
||||
inputSource.close(null);
|
||||
String lineFromFile = readLine();
|
||||
|
||||
assertEquals(TEST_STRING, lineFromFile);
|
||||
@@ -125,7 +125,7 @@ public class FlatFileItemWriterTests extends TestCase {
|
||||
});
|
||||
Object data = new Object();
|
||||
inputSource.write(data);
|
||||
inputSource.close();
|
||||
inputSource.close(null);
|
||||
String lineFromFile = readLine();
|
||||
// converter not used if input is String
|
||||
assertEquals("FOO:" + data.toString(), lineFromFile);
|
||||
@@ -143,7 +143,7 @@ public class FlatFileItemWriterTests extends TestCase {
|
||||
});
|
||||
Object data = new Object();
|
||||
inputSource.write(data);
|
||||
inputSource.close();
|
||||
inputSource.close(null);
|
||||
String lineFromFile = readLine();
|
||||
// converter not used if input is String
|
||||
assertEquals("FOO:" + data.toString(), lineFromFile);
|
||||
@@ -160,7 +160,7 @@ public class FlatFileItemWriterTests extends TestCase {
|
||||
}
|
||||
});
|
||||
inputSource.write(TEST_STRING);
|
||||
inputSource.close();
|
||||
inputSource.close(null);
|
||||
String lineFromFile = readLine();
|
||||
assertEquals("FOO:" + TEST_STRING, lineFromFile);
|
||||
}
|
||||
@@ -174,7 +174,7 @@ public class FlatFileItemWriterTests extends TestCase {
|
||||
|
||||
// AggregatorStub ignores the LineDescriptor, so we pass null
|
||||
inputSource.write(args);
|
||||
inputSource.close();
|
||||
inputSource.close(null);
|
||||
String lineFromFile = readLine();
|
||||
assertEquals(args, lineFromFile);
|
||||
}
|
||||
@@ -183,7 +183,7 @@ public class FlatFileItemWriterTests extends TestCase {
|
||||
inputSource.write("testLine1");
|
||||
// rollback
|
||||
rollback();
|
||||
inputSource.close();
|
||||
inputSource.close(null);
|
||||
String lineFromFile = readLine();
|
||||
assertEquals(null, lineFromFile);
|
||||
}
|
||||
@@ -192,7 +192,7 @@ public class FlatFileItemWriterTests extends TestCase {
|
||||
inputSource.write("testLine1");
|
||||
// rollback
|
||||
commit();
|
||||
inputSource.close();
|
||||
inputSource.close(null);
|
||||
String lineFromFile = readLine();
|
||||
assertEquals("testLine1", lineFromFile);
|
||||
}
|
||||
@@ -222,9 +222,9 @@ public class FlatFileItemWriterTests extends TestCase {
|
||||
commit();
|
||||
|
||||
// get restart data
|
||||
inputSource.update();
|
||||
inputSource.update(executionContext);
|
||||
// close template
|
||||
inputSource.close();
|
||||
inputSource.close(executionContext);
|
||||
|
||||
// init with correct data
|
||||
inputSource.open(executionContext);
|
||||
@@ -235,9 +235,9 @@ public class FlatFileItemWriterTests extends TestCase {
|
||||
inputSource.write("testLine8");
|
||||
|
||||
// get statistics
|
||||
inputSource.update();
|
||||
inputSource.update(executionContext);
|
||||
// close template
|
||||
inputSource.close();
|
||||
inputSource.close(executionContext);
|
||||
|
||||
// verify what was written to the file
|
||||
for (int i = 1; i < 9; i++) {
|
||||
@@ -266,7 +266,7 @@ public class FlatFileItemWriterTests extends TestCase {
|
||||
inputSource.setFieldSetUnmapper(new PassThroughFieldSetMapper());
|
||||
inputSource.afterPropertiesSet();
|
||||
inputSource.open(executionContext);
|
||||
inputSource.update();
|
||||
inputSource.update(executionContext);
|
||||
assertNotNull(executionContext);
|
||||
assertEquals(3, executionContext.entrySet().size());
|
||||
assertEquals(0, executionContext.getLong(FlatFileItemWriter.class.getName() + "." + FlatFileItemWriter.RESTART_DATA_NAME));
|
||||
|
||||
@@ -66,9 +66,9 @@ public class ResourceLineReaderTests extends TestCase {
|
||||
Resource resource = new ByteArrayResource("a,b,c\n1,2,3".getBytes());
|
||||
ResourceLineReader reader = new ResourceLineReader(resource);
|
||||
reader.open();
|
||||
reader.close();
|
||||
reader.close(null);
|
||||
try {
|
||||
reader.close(); // just closing a BufferedReader twice should be fine
|
||||
reader.close(null); // just closing a BufferedReader twice should be fine
|
||||
} catch (Exception e) {
|
||||
fail("Unexpected Exception "+e);
|
||||
}
|
||||
@@ -181,7 +181,7 @@ public class ResourceLineReaderTests extends TestCase {
|
||||
Resource resource = new ByteArrayResource("1\n# 2\n3".getBytes());
|
||||
ResourceLineReader reader = new ResourceLineReader(resource);
|
||||
reader.read();
|
||||
reader.close();
|
||||
reader.close(null);
|
||||
reader.mark();
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ public abstract class AbstractJdbcItemReaderIntegrationTests extends AbstractTra
|
||||
Foo foo2 = (Foo) itemReader.read();
|
||||
assertEquals(2, foo2.getValue());
|
||||
|
||||
getAsItemStream(itemReader).update();
|
||||
getAsItemStream(itemReader).update(executionContext);
|
||||
|
||||
// create new input source
|
||||
itemReader = createItemReader();
|
||||
@@ -101,7 +101,7 @@ public abstract class AbstractJdbcItemReaderIntegrationTests extends AbstractTra
|
||||
Foo foo2 = (Foo) itemReader.read();
|
||||
assertEquals(2, foo2.getValue());
|
||||
|
||||
getAsItemStream(itemReader).update();
|
||||
getAsItemStream(itemReader).update(executionContext);
|
||||
|
||||
// create new input source
|
||||
itemReader = createItemReader();
|
||||
|
||||
@@ -46,7 +46,7 @@ public abstract class AbstractDataSourceItemReaderIntegrationTests extends
|
||||
* @see org.springframework.test.AbstractTransactionalSpringContextTests#onTearDownAfterTransaction()
|
||||
*/
|
||||
protected void onTearDownAfterTransaction() throws Exception {
|
||||
getAsItemStream(reader).close();
|
||||
getAsItemStream(reader).close(null);
|
||||
super.onTearDownAfterTransaction();
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ public abstract class AbstractDataSourceItemReaderIntegrationTests extends
|
||||
Foo foo2 = (Foo) reader.read();
|
||||
assertEquals(2, foo2.getValue());
|
||||
|
||||
getAsItemStream(reader).update();
|
||||
getAsItemStream(reader).update(executionContext);
|
||||
|
||||
// create new input source
|
||||
reader = createItemReader();
|
||||
@@ -113,7 +113,7 @@ public abstract class AbstractDataSourceItemReaderIntegrationTests extends
|
||||
Foo foo2 = (Foo) reader.read();
|
||||
assertEquals(2, foo2.getValue());
|
||||
|
||||
getAsItemStream(reader).update();
|
||||
getAsItemStream(reader).update(executionContext);
|
||||
|
||||
// create new input source
|
||||
reader = createItemReader();
|
||||
@@ -135,7 +135,7 @@ public abstract class AbstractDataSourceItemReaderIntegrationTests extends
|
||||
* @throws Exception
|
||||
*/
|
||||
public void testRestoreFromEmptyData() throws Exception {
|
||||
getAsItemStream(reader).update();
|
||||
getAsItemStream(reader).update(executionContext);
|
||||
|
||||
Foo foo = (Foo) reader.read();
|
||||
assertEquals(1, foo.getValue());
|
||||
@@ -218,7 +218,7 @@ public abstract class AbstractDataSourceItemReaderIntegrationTests extends
|
||||
|
||||
rollback();
|
||||
|
||||
getAsItemStream(reader).update();
|
||||
getAsItemStream(reader).update(executionContext);
|
||||
|
||||
// create new input source
|
||||
reader = createItemReader();
|
||||
|
||||
@@ -92,7 +92,7 @@ public class StaxEventItemReaderTests extends TestCase {
|
||||
assertNotNull(source.read());
|
||||
assertNull(source.read()); // there are only two fragments
|
||||
|
||||
source.close();
|
||||
source.close(executionContext);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -117,7 +117,8 @@ public class StaxEventItemReaderTests extends TestCase {
|
||||
public void testRestart() {
|
||||
source.open(executionContext);
|
||||
source.read();
|
||||
source.update();
|
||||
source.update(executionContext);
|
||||
System.out.println(executionContext);
|
||||
assertEquals(1, executionContext.getLong(StaxEventItemReader.READ_COUNT_STATISTICS_NAME));
|
||||
List expectedAfterRestart = (List) source.read();
|
||||
|
||||
@@ -146,8 +147,8 @@ public class StaxEventItemReaderTests extends TestCase {
|
||||
}
|
||||
|
||||
public void testRestoreWorksFromClosedStream() throws Exception {
|
||||
source.close();
|
||||
source.update();
|
||||
source.close(executionContext);
|
||||
source.update(executionContext);
|
||||
}
|
||||
/**
|
||||
* Skipping marked records after rollback.
|
||||
@@ -198,13 +199,13 @@ public class StaxEventItemReaderTests extends TestCase {
|
||||
public void testExecutionContext() {
|
||||
final int NUMBER_OF_RECORDS = 2;
|
||||
source.open(executionContext);
|
||||
source.update();
|
||||
source.update(executionContext);
|
||||
|
||||
for (int i = 0; i < NUMBER_OF_RECORDS; i++) {
|
||||
long recordCount = extractRecordCount();
|
||||
assertEquals(i, recordCount);
|
||||
source.read();
|
||||
source.update();
|
||||
source.update(executionContext);
|
||||
}
|
||||
|
||||
assertEquals(NUMBER_OF_RECORDS, extractRecordCount());
|
||||
@@ -217,7 +218,7 @@ public class StaxEventItemReaderTests extends TestCase {
|
||||
}
|
||||
|
||||
public void testCloseWithoutOpen() throws Exception {
|
||||
source.close();
|
||||
source.close(null);
|
||||
// No error!
|
||||
}
|
||||
|
||||
@@ -235,7 +236,7 @@ public class StaxEventItemReaderTests extends TestCase {
|
||||
assertNotNull(item);
|
||||
assertTrue(newSource.isOpenCalled());
|
||||
|
||||
newSource.close();
|
||||
newSource.close(null);
|
||||
newSource.setOpenCalled(false);
|
||||
// calling read again should require re-initialization because of close
|
||||
try {
|
||||
@@ -304,6 +305,7 @@ public class StaxEventItemReaderTests extends TestCase {
|
||||
|
||||
newSource.setFragmentRootElementName(FRAGMENT_ROOT_ELEMENT);
|
||||
newSource.setFragmentDeserializer(deserializer);
|
||||
newSource.setSaveState(true);
|
||||
|
||||
return newSource;
|
||||
}
|
||||
|
||||
@@ -94,14 +94,14 @@ public class StaxEventItemWriterTests extends TestCase {
|
||||
// write record
|
||||
writer.write(record);
|
||||
// writer.mark();
|
||||
writer.update();
|
||||
writer.close();
|
||||
writer.update(executionContext);
|
||||
writer.close(executionContext);
|
||||
|
||||
// create new writer from saved restart data and continue writing
|
||||
writer = createItemWriter();
|
||||
writer.open(executionContext);
|
||||
writer.write(record);
|
||||
writer.close();
|
||||
writer.close(executionContext);
|
||||
|
||||
// check the output is concatenation of 'before restart' and 'after
|
||||
// restart' writes.
|
||||
@@ -124,8 +124,8 @@ public class StaxEventItemWriterTests extends TestCase {
|
||||
final int NUMBER_OF_RECORDS = 10;
|
||||
for (int i = 1; i <= NUMBER_OF_RECORDS; i++) {
|
||||
writer.write(record);
|
||||
writer.update();
|
||||
long writeStatistics = executionContext.getLong(StaxEventItemWriter.WRITE_STATISTICS_NAME);
|
||||
writer.update(executionContext);
|
||||
long writeStatistics = executionContext.getLong(StaxEventItemWriter.class.getName() + "." + StaxEventItemWriter.WRITE_STATISTICS_NAME);
|
||||
|
||||
assertEquals(i, writeStatistics);
|
||||
}
|
||||
@@ -146,7 +146,7 @@ public class StaxEventItemWriterTests extends TestCase {
|
||||
|
||||
assertTrue(outputFileContent().indexOf("<testroot attribute=\"value\"") != NOT_FOUND);
|
||||
|
||||
writer.close();
|
||||
writer.close(null);
|
||||
assertTrue(outputFileContent().endsWith("</testroot>"));
|
||||
}
|
||||
|
||||
@@ -207,6 +207,7 @@ public class StaxEventItemWriterTests extends TestCase {
|
||||
source.setRootTagName("root");
|
||||
source.setVersion("1.0");
|
||||
source.setOverwriteOutput(true);
|
||||
source.setSaveState(true);
|
||||
|
||||
source.afterPropertiesSet();
|
||||
|
||||
|
||||
@@ -21,9 +21,9 @@ import java.util.Properties;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.springframework.batch.io.Skippable;
|
||||
import org.springframework.batch.item.ExecutionContext;
|
||||
import org.springframework.batch.item.ItemReader;
|
||||
import org.springframework.batch.item.ItemStream;
|
||||
import org.springframework.batch.item.ExecutionContext;
|
||||
import org.springframework.batch.support.PropertiesConverter;
|
||||
|
||||
/**
|
||||
@@ -76,7 +76,7 @@ public class DelegatingItemReaderTests extends TestCase {
|
||||
* Gets restart data from the input template
|
||||
*/
|
||||
public void testGetStreamContext() {
|
||||
itemProvider.update();
|
||||
itemProvider.update(executionContext);
|
||||
assertEquals("foo", executionContext.getString("value"));
|
||||
}
|
||||
|
||||
@@ -88,26 +88,24 @@ public class DelegatingItemReaderTests extends TestCase {
|
||||
private static class MockItemReader extends AbstractItemReader implements ItemReader, ItemStream, Skippable {
|
||||
|
||||
private Object value;
|
||||
private ExecutionContext executionContext;
|
||||
|
||||
public Properties getStatistics() {
|
||||
return PropertiesConverter.stringToProperties("a=b");
|
||||
}
|
||||
|
||||
public void update() {
|
||||
public void update(ExecutionContext executionContext) {
|
||||
executionContext.putString("value", "foo");
|
||||
}
|
||||
|
||||
public MockItemReader(Object value, ExecutionContext executionContext) {
|
||||
this.value = value;
|
||||
this.executionContext = executionContext;
|
||||
}
|
||||
|
||||
public Object read() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void close() {
|
||||
public void close(ExecutionContext executionContext) {
|
||||
}
|
||||
|
||||
public void open(ExecutionContext executionContext) {
|
||||
|
||||
@@ -103,11 +103,11 @@ public class SimpleStreamManagerTests extends TestCase {
|
||||
*/
|
||||
public void testMark() {
|
||||
manager.register(new ItemStreamSupport() {
|
||||
public void update() {
|
||||
public void update(ExecutionContext executionContext) {
|
||||
list.add("bar");
|
||||
}
|
||||
});
|
||||
manager.update();
|
||||
manager.update(null);
|
||||
assertEquals(1, list.size());
|
||||
}
|
||||
|
||||
@@ -117,11 +117,11 @@ public class SimpleStreamManagerTests extends TestCase {
|
||||
*/
|
||||
public void testClose() {
|
||||
manager.register(new ItemStreamSupport() {
|
||||
public void close() throws StreamException {
|
||||
public void close(ExecutionContext executionContext) throws StreamException {
|
||||
list.add("bar");
|
||||
}
|
||||
});
|
||||
manager.close();
|
||||
manager.close(null);
|
||||
assertEquals(1, list.size());
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ public class SimpleStreamManagerTests extends TestCase {
|
||||
*/
|
||||
public void testCommitWithoutMark() {
|
||||
manager.register(new ItemStreamSupport() {
|
||||
public void update() {
|
||||
public void update(ExecutionContext executionContext) {
|
||||
list.add("bar");
|
||||
}
|
||||
});
|
||||
@@ -146,7 +146,7 @@ public class SimpleStreamManagerTests extends TestCase {
|
||||
*/
|
||||
public void testRollbackWithoutMark() {
|
||||
manager.register( new ItemStreamSupport() {
|
||||
public void update() {
|
||||
public void update(ExecutionContext executionContext) {
|
||||
list.add("bar");
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user