IN PROGRESS - issue BATCH-7: Remove transaction synchronization and state management from input/output sources (formerly buffering)
http://jira.springframework.org/browse/BATCH-7 Javadocs for isMarkSupported().
This commit is contained in:
@@ -25,6 +25,7 @@ import org.hibernate.SessionFactory;
|
||||
import org.hibernate.StatelessSession;
|
||||
import org.springframework.batch.io.Skippable;
|
||||
import org.springframework.batch.item.ItemReader;
|
||||
import org.springframework.batch.item.ItemStream;
|
||||
import org.springframework.batch.item.StreamContext;
|
||||
import org.springframework.batch.item.reader.AbstractItemStreamItemReader;
|
||||
import org.springframework.beans.factory.DisposableBean;
|
||||
@@ -218,8 +219,10 @@ public class HibernateCursorItemReader extends AbstractItemStreamItemReader impl
|
||||
}
|
||||
|
||||
/**
|
||||
* Always true, but only supported through a single processed row count, so
|
||||
* do not use in an asynchronous setting.
|
||||
* Mark is supported as long as this {@link ItemStream} is used in a
|
||||
* single-threaded environment. The state backing the mark is a single
|
||||
* counter, keeping track of the current position, so multiple threads
|
||||
* cannot be accommodated.
|
||||
*
|
||||
* @see org.springframework.batch.item.ItemStream#isMarkSupported()
|
||||
*/
|
||||
|
||||
@@ -223,7 +223,10 @@ public class DrivingQueryItemReader extends AbstractTransactionalIoSource
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true.
|
||||
* Mark is supported as long as this {@link ItemStream} is used in a
|
||||
* single-threaded environment. The state backing the mark is a single
|
||||
* counter, keeping track of the current position, so multiple threads
|
||||
* cannot be accommodated.
|
||||
*
|
||||
* @see org.springframework.batch.item.ItemStream#isMarkSupported()
|
||||
*/
|
||||
|
||||
@@ -29,10 +29,10 @@ import org.springframework.batch.item.StreamException;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* This class is a {@link FieldSetItemReader} that supports restart,
|
||||
* skipping invalid lines and storing statistics.
|
||||
* This class is a {@link FieldSetItemReader} that supports restart, skipping
|
||||
* invalid lines and storing statistics.
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* @author Waseem Malik
|
||||
* @author Tomas Slanina
|
||||
* @author Robert Kasanicky
|
||||
@@ -49,7 +49,7 @@ public class DefaultFlatFileItemReader extends SimpleFlatFileItemReader implemen
|
||||
private Set skippedLines = new HashSet();
|
||||
|
||||
/**
|
||||
* Initialize the input source.
|
||||
* Initialize the input source.
|
||||
*/
|
||||
public void open() {
|
||||
super.open();
|
||||
@@ -60,15 +60,13 @@ public class DefaultFlatFileItemReader extends SimpleFlatFileItemReader implemen
|
||||
* This method initialises the Input Source for Restart. It opens the input
|
||||
* file and position the buffer reader according to information provided by
|
||||
* the restart data
|
||||
*
|
||||
*
|
||||
* @param data {@link StreamContext} information
|
||||
*/
|
||||
public void restoreFrom(StreamContext data) {
|
||||
|
||||
if (data==null ||
|
||||
data.getProperties() == null ||
|
||||
data.getProperties().getProperty(READ_STATISTICS_NAME) == null ||
|
||||
getReader()==null) {
|
||||
if (data == null || data.getProperties() == null
|
||||
|| data.getProperties().getProperty(READ_STATISTICS_NAME) == null || getReader() == null) {
|
||||
// do nothing
|
||||
return;
|
||||
}
|
||||
@@ -82,7 +80,7 @@ public class DefaultFlatFileItemReader extends SimpleFlatFileItemReader implemen
|
||||
while (reader.getCurrentLineCount() < lineCount && record != null) {
|
||||
record = readLine();
|
||||
}
|
||||
|
||||
|
||||
mark(data);
|
||||
|
||||
}
|
||||
@@ -93,7 +91,7 @@ public class DefaultFlatFileItemReader extends SimpleFlatFileItemReader implemen
|
||||
* case of restart.
|
||||
*/
|
||||
public StreamContext getStreamContext() {
|
||||
if (reader==null) {
|
||||
if (reader == null) {
|
||||
throw new StreamException("ItemStream not open or already closed.");
|
||||
}
|
||||
StreamContext streamContext = new StreamContext();
|
||||
@@ -102,21 +100,28 @@ public class DefaultFlatFileItemReader extends SimpleFlatFileItemReader implemen
|
||||
return streamContext;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
/**
|
||||
* Mark is supported as long as this {@link ItemStream} is used in a
|
||||
* single-threaded environment. The state backing the mark is a single
|
||||
* counter, keeping track of the current position, so multiple threads
|
||||
* cannot be accommodated.
|
||||
*
|
||||
* @see org.springframework.batch.item.ItemStream#isMarkSupported()
|
||||
*/
|
||||
public boolean isMarkSupported() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.batch.item.ItemStream#mark(org.springframework.batch.item.StreamContext)
|
||||
*/
|
||||
public void mark(StreamContext streamContext) {
|
||||
getReader().mark();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.batch.item.ItemStream#reset(org.springframework.batch.item.StreamContext)
|
||||
*/
|
||||
public void reset(StreamContext streamContext) {
|
||||
|
||||
@@ -538,7 +538,11 @@ public class FlatFileItemWriter extends AbstractTransactionalIoSource implements
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true.
|
||||
* Mark is supported as long as this {@link ItemStream} is used in a
|
||||
* single-threaded environment. The state backing the mark is a single
|
||||
* counter, keeping track of the current position, so multiple threads
|
||||
* cannot be accommodated.
|
||||
*
|
||||
* @see org.springframework.batch.item.ItemStream#isMarkSupported()
|
||||
*/
|
||||
public boolean isMarkSupported() {
|
||||
|
||||
@@ -251,7 +251,12 @@ public class StaxEventItemReader extends AbstractItemReader implements ItemReade
|
||||
close();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
/**
|
||||
* Mark is supported as long as this {@link ItemStream} is used in a
|
||||
* single-threaded environment. The state backing the mark is a single
|
||||
* counter, keeping track of the current position, so multiple threads
|
||||
* cannot be accommodated.
|
||||
*
|
||||
* @see org.springframework.batch.item.ItemStream#isMarkSupported()
|
||||
*/
|
||||
public boolean isMarkSupported() {
|
||||
|
||||
@@ -435,7 +435,12 @@ public class StaxEventItemWriter implements ItemWriter, ItemStream, Initializing
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
/**
|
||||
* Mark is supported as long as this {@link ItemStream} is used in a
|
||||
* single-threaded environment. The state backing the mark is a single
|
||||
* counter, keeping track of the current position, so multiple threads
|
||||
* cannot be accommodated.
|
||||
*
|
||||
* @see org.springframework.batch.item.ItemStream#isMarkSupported()
|
||||
*/
|
||||
public boolean isMarkSupported() {
|
||||
|
||||
@@ -104,7 +104,9 @@ public class DelegatingItemReader extends AbstractItemReader implements Skippabl
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
/**
|
||||
* Delegates the call if the delegate is an {@link ItemStream}.
|
||||
*
|
||||
* @see org.springframework.batch.item.ItemStream#isMarkSupported()
|
||||
*/
|
||||
public boolean isMarkSupported() {
|
||||
|
||||
Reference in New Issue
Block a user