From 72f49d7828ef7a8f87833a1bf8b398daca30bfdb Mon Sep 17 00:00:00 2001 From: robokaso Date: Tue, 9 Sep 2008 11:41:25 +0000 Subject: [PATCH] IN PROGRESS - BATCH-805: Check noRollbackFor semantics in item/chunk oriented tasklets added logging for swallowed exceptions, removed non-rollback considerations for ItemStream.update call --- .../batch/core/step/tasklet/TaskletStep.java | 30 ++++++++----------- 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/tasklet/TaskletStep.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/tasklet/TaskletStep.java index 37d5a9f54..ff85108a6 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/tasklet/TaskletStep.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/tasklet/TaskletStep.java @@ -206,9 +206,9 @@ public class TaskletStep extends AbstractStep { * Process the step and update its context so that progress can be monitored * by the caller. The step is broken down into chunks, each one executing in * a transaction. The step and its execution and execution context are all - * given an up to date {@link BatchStatus}, and the {@link JobRepository} - * is used to store the result. Various reporting information are also added - * to the current context (the {@link RepeatContext} governing the step + * given an up to date {@link BatchStatus}, and the {@link JobRepository} is + * used to store the result. Various reporting information are also added to + * the current context (the {@link RepeatContext} governing the step * execution, which would normally be available to the caller somehow * through the step's {@link ExecutionContext}.
* @@ -255,11 +255,17 @@ public class TaskletStep extends AbstractStep { if (transactionAttribute.rollbackOn(e)) { throw e; } + else { + logger.error("Ecountered error that should not cause rollback: ", e); + } } catch (Exception e) { if (transactionAttribute.rollbackOn(e)) { throw e; } + else { + logger.error("Ecountered error that should not cause rollback: ", e); + } } finally { // Still some stuff to do with the data in this chunk, @@ -289,19 +295,7 @@ public class TaskletStep extends AbstractStep { Thread.currentThread().interrupt(); } - try { - stream.update(stepExecution.getExecutionContext()); - } - catch (Error e) { - if (transactionAttribute.rollbackOn(e)) { - throw e; - } - } - catch (Exception e) { - if (transactionAttribute.rollbackOn(e)) { - throw e; - } - } + stream.update(stepExecution.getExecutionContext()); try { getJobRepository().updateExecutionContext(stepExecution); @@ -380,8 +374,8 @@ public class TaskletStep extends AbstractStep { } catch (Exception e) { /* - * If we already failed to commit, it doesn't help to do this again - - * it's better to allow the CommitFailedException to propagate + * If we already failed to commit, it doesn't help to do this again + * - it's better to allow the CommitFailedException to propagate */ if (!fatalException.hasException()) { fatalException.setException(e);