BATCH-219 and BATCH-330: Created ExecutionAttributes, which are stored in the table BATCH_STEP_EXECUTION_ATTRIBUTES.
This commit is contained in:
@@ -13,7 +13,7 @@ import org.springframework.batch.execution.scope.StepContext;
|
||||
import org.springframework.batch.execution.scope.StepContextAware;
|
||||
import org.springframework.batch.item.ItemStream;
|
||||
import org.springframework.batch.item.KeyedItemReader;
|
||||
import org.springframework.batch.item.StreamContext;
|
||||
import org.springframework.batch.item.ExecutionAttributes;
|
||||
import org.springframework.batch.sample.item.writer.StagingItemWriter;
|
||||
import org.springframework.beans.factory.DisposableBean;
|
||||
import org.springframework.dao.OptimisticLockingFailureException;
|
||||
@@ -219,7 +219,7 @@ public class StagingItemReader extends JdbcDaoSupport implements ItemStream, Key
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.batch.item.ItemStream#mark(org.springframework.batch.item.StreamContext)
|
||||
*/
|
||||
public void mark(StreamContext streamContext) {
|
||||
public void mark(ExecutionAttributes streamContext) {
|
||||
getBuffer().commit();
|
||||
}
|
||||
|
||||
@@ -227,7 +227,7 @@ public class StagingItemReader extends JdbcDaoSupport implements ItemStream, Key
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.batch.item.ItemStream#reset(org.springframework.batch.item.StreamContext)
|
||||
*/
|
||||
public void reset(StreamContext streamContext) {
|
||||
public void reset(ExecutionAttributes streamContext) {
|
||||
getBuffer().rollback();
|
||||
}
|
||||
|
||||
@@ -235,7 +235,7 @@ public class StagingItemReader extends JdbcDaoSupport implements ItemStream, Key
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.batch.item.ItemStream#restoreFrom(org.springframework.batch.item.StreamContext)
|
||||
*/
|
||||
public void restoreFrom(StreamContext context) {
|
||||
public void restoreFrom(ExecutionAttributes context) {
|
||||
// no-op
|
||||
}
|
||||
|
||||
@@ -243,8 +243,8 @@ public class StagingItemReader extends JdbcDaoSupport implements ItemStream, Key
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.batch.item.StreamContextProvider#getStreamContext()
|
||||
*/
|
||||
public StreamContext getStreamContext() {
|
||||
return new StreamContext();
|
||||
public ExecutionAttributes getStreamContext() {
|
||||
return new ExecutionAttributes();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
package org.springframework.batch.sample.tasklet;
|
||||
|
||||
import org.springframework.batch.core.tasklet.Tasklet;
|
||||
import org.springframework.batch.item.StreamContext;
|
||||
import org.springframework.batch.item.ExecutionAttributes;
|
||||
import org.springframework.batch.item.StreamContextProvider;
|
||||
import org.springframework.batch.repeat.ExitStatus;
|
||||
import org.springframework.batch.support.PropertiesConverter;
|
||||
@@ -51,8 +51,8 @@ public class InfiniteLoopTasklet implements Tasklet, StreamContextProvider {
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.batch.item.stream.ItemStreamAdapter#getStreamContext()
|
||||
*/
|
||||
public StreamContext getStreamContext() {
|
||||
return new StreamContext(PropertiesConverter.stringToProperties("count=" + count));
|
||||
public ExecutionAttributes getStreamContext() {
|
||||
return new ExecutionAttributes(PropertiesConverter.stringToProperties("count=" + count));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ package org.springframework.batch.sample.tasklet;
|
||||
import org.springframework.batch.core.tasklet.Tasklet;
|
||||
import org.springframework.batch.execution.tasklet.ItemOrientedTasklet;
|
||||
import org.springframework.batch.io.file.DefaultFlatFileItemReader;
|
||||
import org.springframework.batch.item.StreamContext;
|
||||
import org.springframework.batch.item.ExecutionAttributes;
|
||||
import org.springframework.batch.item.StreamContextProvider;
|
||||
import org.springframework.batch.repeat.ExitStatus;
|
||||
import org.springframework.batch.sample.dao.TradeDao;
|
||||
@@ -86,8 +86,8 @@ public class SimpleTradeTasklet implements Tasklet, StreamContextProvider {
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.item.StreamContextProvider#getStreamContext()
|
||||
*/
|
||||
public StreamContext getStreamContext() {
|
||||
StreamContext statistics = new StreamContext();
|
||||
public ExecutionAttributes getStreamContext() {
|
||||
ExecutionAttributes statistics = new ExecutionAttributes();
|
||||
statistics.putLong("trade.count", tradeCount);
|
||||
return statistics;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user