OPEN - BATCH-654: Transactions when commit fails
reverted the previous solution, it wouldn't really help
This commit is contained in:
@@ -265,23 +265,18 @@ public class ItemOrientedStep extends AbstractStep {
|
||||
throw new FatalException("Fatal error detected during save of step execution context", e);
|
||||
}
|
||||
|
||||
itemHandler.mark();
|
||||
|
||||
try {
|
||||
itemHandler.mark();
|
||||
transactionManager.commit(transaction);
|
||||
}
|
||||
catch (Exception e) {
|
||||
fatalException.setException(e);
|
||||
stepExecution.setStatus(BatchStatus.UNKNOWN);
|
||||
logger.error("Fatal error detected during commit.");
|
||||
throw new CommitException("Fatal error detected during commit - "
|
||||
+ "the execution is in undefined state and restart will not be possible", e);
|
||||
throw new FatalException("Fatal error detected during commit", e);
|
||||
}
|
||||
|
||||
}
|
||||
catch (CommitException e) {
|
||||
// trying to rollback after failed commit would just be
|
||||
// asking for more trouble - die ASAP
|
||||
throw e;
|
||||
}
|
||||
catch (Error e) {
|
||||
processRollback(stepExecution, contribution, fatalException, transaction);
|
||||
throw e;
|
||||
@@ -387,15 +382,6 @@ public class ItemOrientedStep extends AbstractStep {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Encapsulates exception thrown while committing transaction.
|
||||
*/
|
||||
private static class CommitException extends FatalException {
|
||||
public CommitException(String msg, Throwable cause) {
|
||||
super(msg, cause);
|
||||
}
|
||||
}
|
||||
|
||||
protected void close(ExecutionContext ctx) throws Exception {
|
||||
stream.close(ctx);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user