Re-order assertion to catch the problem if it exists earlier

This commit is contained in:
dsyer
2008-02-05 10:28:18 +00:00
parent 8ac9c65b78
commit 39210aa3d6

View File

@@ -144,12 +144,12 @@ public class StagingItemReader extends JdbcDaoSupport implements ItemStream, Key
if (key == null) {
synchronized (lock) {
if (keys.hasNext()) {
Assert.state(TransactionSynchronizationManager.isActualTransactionActive(),
"Transaction not active for this thread.");
Long next = (Long) keys.next();
getBuffer().add(next);
key = next;
logger.debug("Retrieved key from list: " + key);
Assert.state(TransactionSynchronizationManager.isActualTransactionActive(),
"Transaction not active for this thread.");
}
}
}
@@ -218,7 +218,7 @@ public class StagingItemReader extends JdbcDaoSupport implements ItemStream, Key
/* (non-Javadoc)
* @see org.springframework.batch.item.ItemStream#mark(org.springframework.batch.item.ExecutionAttributes)
*/
public void mark(ExecutionAttributes executionAttributes) {
public void mark() {
getBuffer().commit();
}