writer.write(Arrays.asList(new String[] { "testLine1", "testLine2", "testLine3" }));
// write more lines
writer.write(Arrays.asList(new String[] { "testLine4", "testLine5" }));
}
catch (Exception e) {
throw new UnexpectedInputException("Could not write data", e);
}
// get restart data
writer.update(executionContext);
return null;
}
});
// close template
writer.close();
// init with correct data
writer.open(executionContext);
new TransactionTemplate(transactionManager).execute(new TransactionCallback<Void>() {
@Override
public Void doInTransaction(TransactionStatus status) {
try {
// write more lines
writer.write(Arrays.asList(new String[] { "testLine6", "testLine7", "testLine8" }));
}
catch (Exception e) {
throw new UnexpectedInputException("Could not write data", e);
}
// get restart data
writer.update(executionContext);
return null;
}