diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/StepContribution.java b/spring-batch-core/src/main/java/org/springframework/batch/core/StepContribution.java
index 1517ec88f..754513f4c 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/StepContribution.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/StepContribution.java
@@ -15,7 +15,6 @@
*/
package org.springframework.batch.core;
-import org.springframework.batch.item.ExecutionContext;
/**
* Represents a contribution to a {@link StepExecution}, buffering changes
@@ -28,9 +27,7 @@ public class StepContribution {
private int taskCount = 0;
- private StepExecution execution;
-
- private ExecutionContext executionContext;
+ private int parentSkipCount;
private int commitCount;
@@ -40,7 +37,7 @@ public class StepContribution {
* @param execution
*/
public StepContribution(StepExecution execution) {
- this.execution = execution;
+ this.parentSkipCount = execution.getSkipCount();
}
/**
@@ -66,23 +63,6 @@ public class StepContribution {
commitCount++;
}
- /**
- * Set the statistics properties.
- *
- * @param executionContext
- */
- public void setExecutionContext(ExecutionContext executionContext) {
- this.executionContext = executionContext;
- }
-
- /**
- * Public getter for the {@link ExecutionContext}.
- * @return the stream context
- */
- public ExecutionContext getExecutionContext() {
- return executionContext;
- }
-
/**
* Public getter for the commit counter.
* @return the commitCount
@@ -91,20 +71,12 @@ public class StepContribution {
return commitCount;
}
- /**
- * Delegate call to the {@link StepExecution}.
- * @return the flag from the underlying execution
- */
- public boolean isTerminateOnly() {
- return execution.isTerminateOnly();
- }
-
/**
* @return the sum of skips accumulated in the parent {@link StepExecution}
* and this StepContribution.
*/
public int getStepSkipCount() {
- return skipCount + execution.getSkipCount();
+ return skipCount + parentSkipCount;
}
/**
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/CommandLineJobRunner.java b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/CommandLineJobRunner.java
index bf1ded2e4..ea02a2695 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/CommandLineJobRunner.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/CommandLineJobRunner.java
@@ -195,11 +195,11 @@ public class CommandLineJobRunner {
.splitArrayElementsIntoProperties(parameters, "="));
JobExecution jobExecution = launcher.run(job, jobParameters);
- return exitCodeMapper.getExitCode(jobExecution.getExitStatus()
+ return exitCodeMapper.intValue(jobExecution.getExitStatus()
.getExitCode());
} catch (Throwable e) {
logger.error("Job Terminated in error:", e);
- return exitCodeMapper.getExitCode(ExitStatus.FAILED.getExitCode());
+ return exitCodeMapper.intValue(ExitStatus.FAILED.getExitCode());
}
}
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/ExitCodeMapper.java b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/ExitCodeMapper.java
index 6eb9e6c4b..0ebf41a38 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/ExitCodeMapper.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/ExitCodeMapper.java
@@ -1,12 +1,12 @@
package org.springframework.batch.core.launch.support;
-
/**
*
- * This interface should be implemented when an environment calling the batch famework has specific
- * requirements regarding the process return codes.
- *
- * @param The type of returncode expected by the environment
+ * This interface should be implemented when an environment calling the batch
+ * framework has specific requirements regarding the operating system process
+ * return status.
+ *
+ * @param The type of return status expected by the environment
* @author Stijn Maller
* @author Lucas Ward
* @author Dave Syer
@@ -14,17 +14,22 @@ package org.springframework.batch.core.launch.support;
public interface ExitCodeMapper {
static int JVM_EXITCODE_COMPLETED = 0;
+
static int JVM_EXITCODE_GENERIC_ERROR = 1;
+
static int JVM_EXITCODE_JOB_ERROR = 2;
+
public static final String NO_SUCH_JOB = "NO_SUCH_JOB";
+
public static final String JOB_NOT_PROVIDED = "JOB_NOT_PROVIDED";
/**
- * Transform the exitcode known by the batchframework into an exitcode in the
- * format of the calling environment.
- * @param exitCode The exitcode which is used internally by the batch framework.
- * @return The corresponding exitcode as known by the calling environment.
+ * Convert the exit code from String into an integer that the calling
+ * environment as an operating system can interpret as an exit status.
+ * @param exitCode The exit code which is used internally.
+ * @return The corresponding exit status as known by the calling
+ * environment.
*/
- public int getExitCode(String exitCode);
-
+ public int intValue(String exitCode);
+
}
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/SimpleJvmExitCodeMapper.java b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/SimpleJvmExitCodeMapper.java
index 679f3bcbe..f0d577b02 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/SimpleJvmExitCodeMapper.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/SimpleJvmExitCodeMapper.java
@@ -23,10 +23,10 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.batch.repeat.ExitStatus;
-
/**
- * An implementation of {@link ExitCodeMapper} that can be configured
- * through a map from batch exit codes (String) to integer results.
+ * An implementation of {@link ExitCodeMapper} that can be configured through a
+ * map from batch exit codes (String) to integer results. Some default entries
+ * are set up to recognise common cases. Any that are injected are added to these.
*
* @author Stijn Maller
* @author Lucas Ward
@@ -36,19 +36,15 @@ import org.springframework.batch.repeat.ExitStatus;
public class SimpleJvmExitCodeMapper implements ExitCodeMapper {
protected Log logger = LogFactory.getLog(getClass());
-
+
private Map mapping;
-
- public SimpleJvmExitCodeMapper(){
+
+ public SimpleJvmExitCodeMapper() {
mapping = new HashMap();
- mapping.put(ExitStatus.FINISHED.getExitCode(),
- new Integer(JVM_EXITCODE_COMPLETED));
- mapping.put(ExitStatus.FAILED.getExitCode(),
- new Integer(JVM_EXITCODE_GENERIC_ERROR));
- mapping.put(ExitCodeMapper.JOB_NOT_PROVIDED,
- new Integer(JVM_EXITCODE_JOB_ERROR));
- mapping.put(ExitCodeMapper.NO_SUCH_JOB,
- new Integer(JVM_EXITCODE_JOB_ERROR));
+ mapping.put(ExitStatus.FINISHED.getExitCode(), new Integer(JVM_EXITCODE_COMPLETED));
+ mapping.put(ExitStatus.FAILED.getExitCode(), new Integer(JVM_EXITCODE_GENERIC_ERROR));
+ mapping.put(ExitCodeMapper.JOB_NOT_PROVIDED, new Integer(JVM_EXITCODE_JOB_ERROR));
+ mapping.put(ExitCodeMapper.NO_SUCH_JOB, new Integer(JVM_EXITCODE_JOB_ERROR));
}
public Map getMapping() {
@@ -56,33 +52,36 @@ public class SimpleJvmExitCodeMapper implements ExitCodeMapper {
}
/**
- * Supply the ExitCodeMappings
- * @param exitCodeMap A set of mappings between environment specific exit codes
- * and batch framework internal exit codes
+ * Supply the ExitCodeMappings
+ * @param exitCodeMap A set of mappings between environment specific exit
+ * codes and batch framework internal exit codes
*/
public void setMapping(Map exitCodeMap) {
mapping.putAll(exitCodeMap);
}
/**
- * Get the JVM exitcode that matches a certain Batch Framework Exitcode
- * @param exitCode The exitcode of the Batch Job as known by the Batch Framework
- * @return The exitCode of the Batch Job as known by the JVM
+ * Get the operating system exit status that matches a certain Batch
+ * Framework Exitcode
+ * @param exitCode The exitcode of the Batch Job as known by the Batch
+ * Framework
+ * @return The exitCode of the Batch Job as known by the JVM
*/
- public int getExitCode(String exitCode) {
-
+ public int intValue(String exitCode) {
+
Integer statusCode = null;
-
- try{
- statusCode = (Integer)mapping.get(exitCode);
+
+ try {
+ statusCode = (Integer) mapping.get(exitCode);
}
- catch(RuntimeException ex){
- //We still need to return an exit code, even if there is an issue with
- //the mapper.
- logger.fatal("Error mapping exit code, generic exit code returned.", ex);
+ catch (RuntimeException ex) {
+ // We still need to return an exit code, even if there is an issue
+ // with
+ // the mapper.
+ logger.fatal("Error mapping exit code, generic exit status returned.", ex);
}
-
+
return (statusCode != null) ? statusCode.intValue() : JVM_EXITCODE_GENERIC_ERROR;
}
-
+
}
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/BackportConcurrentStepExecutionSynchronizer.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/BackportConcurrentStepExecutionSynchronizer.java
similarity index 96%
rename from spring-batch-core/src/main/java/org/springframework/batch/core/step/item/BackportConcurrentStepExecutionSynchronizer.java
rename to spring-batch-core/src/main/java/org/springframework/batch/core/step/BackportConcurrentStepExecutionSynchronizer.java
index ab4328027..5eb8a4df1 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/BackportConcurrentStepExecutionSynchronizer.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/BackportConcurrentStepExecutionSynchronizer.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.batch.core.step.item;
+package org.springframework.batch.core.step;
import org.springframework.batch.core.StepExecution;
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/ExitStatusExceptionClassifier.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/ExitStatusExceptionClassifier.java
similarity index 96%
rename from spring-batch-core/src/main/java/org/springframework/batch/core/step/item/ExitStatusExceptionClassifier.java
rename to spring-batch-core/src/main/java/org/springframework/batch/core/step/ExitStatusExceptionClassifier.java
index 86b7395e8..ba9c9d592 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/ExitStatusExceptionClassifier.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/ExitStatusExceptionClassifier.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.batch.core.step.item;
+package org.springframework.batch.core.step;
import org.springframework.batch.repeat.ExitStatus;
import org.springframework.batch.support.ExceptionClassifier;
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/JdkConcurrentStepExecutionSynchronizer.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/JdkConcurrentStepExecutionSynchronizer.java
similarity index 95%
rename from spring-batch-core/src/main/java/org/springframework/batch/core/step/item/JdkConcurrentStepExecutionSynchronizer.java
rename to spring-batch-core/src/main/java/org/springframework/batch/core/step/JdkConcurrentStepExecutionSynchronizer.java
index 677154818..442103107 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/JdkConcurrentStepExecutionSynchronizer.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/JdkConcurrentStepExecutionSynchronizer.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.springframework.batch.core.step.item;
+package org.springframework.batch.core.step;
import java.util.concurrent.Semaphore;
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/SimpleExitStatusExceptionClassifier.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/SimpleExitStatusExceptionClassifier.java
similarity index 98%
rename from spring-batch-core/src/main/java/org/springframework/batch/core/step/item/SimpleExitStatusExceptionClassifier.java
rename to spring-batch-core/src/main/java/org/springframework/batch/core/step/SimpleExitStatusExceptionClassifier.java
index 279a2be8e..1347d2d9a 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/SimpleExitStatusExceptionClassifier.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/SimpleExitStatusExceptionClassifier.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.batch.core.step.item;
+package org.springframework.batch.core.step;
import java.io.PrintWriter;
import java.io.StringWriter;
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/StepExecutionSynchronizer.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/StepExecutionSynchronizer.java
similarity index 96%
rename from spring-batch-core/src/main/java/org/springframework/batch/core/step/item/StepExecutionSynchronizer.java
rename to spring-batch-core/src/main/java/org/springframework/batch/core/step/StepExecutionSynchronizer.java
index 8d65c1513..29c7ec3cd 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/StepExecutionSynchronizer.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/StepExecutionSynchronizer.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.batch.core.step.item;
+package org.springframework.batch.core.step;
import org.springframework.batch.core.StepExecution;
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/StepExecutionSyncronizerFactory.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/StepExecutionSyncronizerFactory.java
similarity index 92%
rename from spring-batch-core/src/main/java/org/springframework/batch/core/step/item/StepExecutionSyncronizerFactory.java
rename to spring-batch-core/src/main/java/org/springframework/batch/core/step/StepExecutionSyncronizerFactory.java
index 1c0f3fb9a..872e3a460 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/StepExecutionSyncronizerFactory.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/StepExecutionSyncronizerFactory.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.springframework.batch.core.step.item;
+package org.springframework.batch.core.step;
import org.springframework.core.JdkVersion;
import org.springframework.util.ClassUtils;
@@ -25,7 +25,7 @@ import org.springframework.util.ClassUtils;
*
* @author Ben Hale
*/
-class StepExecutionSyncronizerFactory {
+public class StepExecutionSyncronizerFactory {
/** Whether the backport-concurrent library is present on the classpath */
private static final boolean backportConcurrentAvailable = ClassUtils.isPresent(
@@ -34,7 +34,7 @@ class StepExecutionSyncronizerFactory {
private final StepExecutionSynchronizer synchronizer;
- StepExecutionSyncronizerFactory() {
+ public StepExecutionSyncronizerFactory() {
if (JdkVersion.isAtLeastJava15()) {
synchronizer = new JdkConcurrentStepExecutionSynchronizer();
} else if (backportConcurrentAvailable) {
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/StepInterruptionPolicy.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/StepInterruptionPolicy.java
similarity index 82%
rename from spring-batch-core/src/main/java/org/springframework/batch/core/step/item/StepInterruptionPolicy.java
rename to spring-batch-core/src/main/java/org/springframework/batch/core/step/StepInterruptionPolicy.java
index ec8a394ee..bc373b4b2 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/StepInterruptionPolicy.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/StepInterruptionPolicy.java
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-package org.springframework.batch.core.step.item;
+package org.springframework.batch.core.step;
import org.springframework.batch.core.JobInterruptedException;
import org.springframework.batch.core.Step;
-import org.springframework.batch.repeat.RepeatContext;
+import org.springframework.batch.core.StepExecution;
/**
* Strategy interface for an interruption policy. This policy allows
@@ -32,9 +32,9 @@ public interface StepInterruptionPolicy {
/**
* Has the job been interrupted? If so then throw a
* {@link JobInterruptedException}.
- * @param context the current context of the running step.
+ * @param stepExecution the current context of the running step.
*
* @throws JobInterruptedException when the job has been interrupted.
*/
- void checkInterrupted(RepeatContext context) throws JobInterruptedException;
+ void checkInterrupted(StepExecution stepExecution) throws JobInterruptedException;
}
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/ThreadStepInterruptionPolicy.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/ThreadStepInterruptionPolicy.java
similarity index 80%
rename from spring-batch-core/src/main/java/org/springframework/batch/core/step/item/ThreadStepInterruptionPolicy.java
rename to spring-batch-core/src/main/java/org/springframework/batch/core/step/ThreadStepInterruptionPolicy.java
index e2ba09359..c1f72fd19 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/ThreadStepInterruptionPolicy.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/ThreadStepInterruptionPolicy.java
@@ -14,12 +14,12 @@
* limitations under the License.
*/
-package org.springframework.batch.core.step.item;
+package org.springframework.batch.core.step;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.batch.core.JobInterruptedException;
-import org.springframework.batch.repeat.RepeatContext;
+import org.springframework.batch.core.StepExecution;
/**
* Policy that checks the current thread to see if it has been interrupted.
@@ -38,20 +38,20 @@ public class ThreadStepInterruptionPolicy implements StepInterruptionPolicy {
* Returns if the current job lifecycle has been interrupted by checking if
* the current thread is interrupted.
*/
- public void checkInterrupted(RepeatContext context) throws JobInterruptedException {
+ public void checkInterrupted(StepExecution stepExecution) throws JobInterruptedException {
- if (isInterrupted(context)) {
+ if (isInterrupted(stepExecution)) {
throw new JobInterruptedException("Job interrupted status detected.");
}
}
/**
- * @param context the current context
+ * @param stepExecution the current context
* @return true if the job has been interrupted
*/
- private boolean isInterrupted(RepeatContext context) {
- boolean interrupted = (Thread.currentThread().isInterrupted() || context.isTerminateOnly());
+ private boolean isInterrupted(StepExecution stepExecution) {
+ boolean interrupted = (Thread.currentThread().isInterrupted() || stepExecution.isTerminateOnly());
if(interrupted){
logger.error("Step interrupted");
}
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/ItemOrientedStep.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/ItemOrientedStep.java
index 631d859a3..1cf89d336 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/ItemOrientedStep.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/ItemOrientedStep.java
@@ -28,7 +28,12 @@ import org.springframework.batch.core.UnexpectedJobExecutionException;
import org.springframework.batch.core.listener.CompositeStepListener;
import org.springframework.batch.core.repository.JobRepository;
import org.springframework.batch.core.step.AbstractStep;
-import org.springframework.batch.core.step.tasklet.Tasklet;
+import org.springframework.batch.core.step.ExitStatusExceptionClassifier;
+import org.springframework.batch.core.step.SimpleExitStatusExceptionClassifier;
+import org.springframework.batch.core.step.StepExecutionSynchronizer;
+import org.springframework.batch.core.step.StepExecutionSyncronizerFactory;
+import org.springframework.batch.core.step.StepInterruptionPolicy;
+import org.springframework.batch.core.step.ThreadStepInterruptionPolicy;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.ItemStream;
import org.springframework.batch.item.ItemWriter;
@@ -268,10 +273,12 @@ public class ItemOrientedStep extends AbstractStep {
public ExitStatus doInIteration(final RepeatContext context) throws Exception {
final StepContribution contribution = stepExecution.createStepContribution();
- contribution.setExecutionContext(stepExecution.getExecutionContext());
// Before starting a new transaction, check for
// interruption.
- interruptionPolicy.checkInterrupted(context);
+ if (stepExecution.isTerminateOnly()) {
+ context.setTerminateOnly();
+ }
+ interruptionPolicy.checkInterrupted(stepExecution);
ExitStatus result = ExitStatus.CONTINUABLE;
@@ -281,7 +288,7 @@ public class ItemOrientedStep extends AbstractStep {
try {
itemHandler.mark();
- result = processChunk(contribution);
+ result = processChunk(stepExecution, contribution);
contribution.incrementCommitCount();
// If the step operations are asynchronous then we need
@@ -340,7 +347,7 @@ public class ItemOrientedStep extends AbstractStep {
// Check for interruption after transaction as well, so that
// the interrupted exception is correctly propagated up to
// caller
- interruptionPolicy.checkInterrupted(context);
+ interruptionPolicy.checkInterrupted(stepExecution);
return result;
@@ -444,23 +451,25 @@ public class ItemOrientedStep extends AbstractStep {
* transaction. The transaction is programmatically started and stopped
* outside this method, so subclasses that override do not need to create a
* transaction.
+ * @param execution the current {@link StepExecution} which should be
+ * treated as read-only for the purposes of this method.
+ * @param contribution the current {@link StepContribution} which can accept
+ * changes to be aggregated later into the step execution.
*
- * @param step the current step containing the {@link Tasklet} with the
- * business logic.
* @return true if there is more data to process.
*/
- protected ExitStatus processChunk(final StepContribution contribution) {
+ protected ExitStatus processChunk(final StepExecution execution, final StepContribution contribution) {
ExitStatus result = chunkOperations.iterate(new RepeatCallback() {
public ExitStatus doInIteration(final RepeatContext context) throws Exception {
- if (contribution.isTerminateOnly()) {
+ if (execution.isTerminateOnly()) {
context.setTerminateOnly();
}
// check for interruption before each item as well
- interruptionPolicy.checkInterrupted(context);
+ interruptionPolicy.checkInterrupted(execution);
ExitStatus exitStatus = itemHandler.handle(contribution);
contribution.incrementTaskCount();
// check for interruption after each item as well
- interruptionPolicy.checkInterrupted(context);
+ interruptionPolicy.checkInterrupted(execution);
return exitStatus;
}
});
@@ -494,8 +503,8 @@ public class ItemOrientedStep extends AbstractStep {
private void processRollback(final StepExecution stepExecution, final ExceptionHolder fatalException,
TransactionStatus transaction) {
/*
- * Any exception thrown within the transaction should
- * automatically cause the transaction to rollback.
+ * Any exception thrown within the transaction should automatically
+ * cause the transaction to rollback.
*/
stepExecution.rollback();
@@ -506,9 +515,8 @@ public class ItemOrientedStep 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);
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/ItemSkipPolicyItemHandler.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/ItemSkipPolicyItemHandler.java
index 0322bc5db..ba6198598 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/ItemSkipPolicyItemHandler.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/ItemSkipPolicyItemHandler.java
@@ -15,8 +15,9 @@
*/
package org.springframework.batch.core.step.item;
-import org.springframework.batch.core.ItemSkipPolicy;
import org.springframework.batch.core.StepContribution;
+import org.springframework.batch.core.step.skip.ItemSkipPolicy;
+import org.springframework.batch.core.step.skip.NeverSkipItemSkipPolicy;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.ItemWriter;
import org.springframework.batch.item.Skippable;
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/SkipLimitStepFactoryBean.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/SkipLimitStepFactoryBean.java
index bfe92d457..ebdc75eca 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/SkipLimitStepFactoryBean.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/SkipLimitStepFactoryBean.java
@@ -2,6 +2,8 @@ package org.springframework.batch.core.step.item;
import java.util.Arrays;
+import org.springframework.batch.core.step.skip.LimitCheckingItemSkipPolicy;
+import org.springframework.batch.core.step.skip.NeverSkipItemSkipPolicy;
import org.springframework.batch.repeat.exception.SimpleLimitExceptionHandler;
/**
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/AlwaysSkipItemSkipPolicy.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/skip/AlwaysSkipItemSkipPolicy.java
similarity index 90%
rename from spring-batch-core/src/main/java/org/springframework/batch/core/step/item/AlwaysSkipItemSkipPolicy.java
rename to spring-batch-core/src/main/java/org/springframework/batch/core/step/skip/AlwaysSkipItemSkipPolicy.java
index 927b6d17e..41035991a 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/AlwaysSkipItemSkipPolicy.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/skip/AlwaysSkipItemSkipPolicy.java
@@ -13,9 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.batch.core.step.item;
+package org.springframework.batch.core.step.skip;
-import org.springframework.batch.core.ItemSkipPolicy;
/**
* Implementation of the {@link ItemSkipPolicy} interface that
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/ItemSkipPolicy.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/skip/ItemSkipPolicy.java
similarity index 66%
rename from spring-batch-core/src/main/java/org/springframework/batch/core/ItemSkipPolicy.java
rename to spring-batch-core/src/main/java/org/springframework/batch/core/step/skip/ItemSkipPolicy.java
index 0282b8275..8a5c84f0d 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/ItemSkipPolicy.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/skip/ItemSkipPolicy.java
@@ -13,25 +13,26 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.batch.core;
-
+package org.springframework.batch.core.step.skip;
/**
- * Policy for determining whether or not an item should be skipped.
+ * Policy for determining whether or not some processing should be skipped.
*
* @author Lucas Ward
+ * @author Dave Syer
*/
public interface ItemSkipPolicy {
/**
- * Returns true or false, indicating whether or not reading should
- * continue for the current step execution with the given throwable.
+ * Returns true or false, indicating whether or not processing should
+ * continue with the given throwable.
*
- * @param t throwable encountered while reading
+ * @param t exception encountered while reading
* @param skipCount currently running count of skips
* @return true if reading should continue, false otherwise.
+ * @throws SkipLimitExceededException if a limit is breached
* @throws IllegalArgumentException if the exception is null
*/
- boolean shouldSkip(Throwable t, int skipCount);
-
+ boolean shouldSkip(Throwable t, int skipCount) throws SkipLimitExceededException;
+
}
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/LimitCheckingItemSkipPolicy.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/skip/LimitCheckingItemSkipPolicy.java
similarity index 97%
rename from spring-batch-core/src/main/java/org/springframework/batch/core/step/item/LimitCheckingItemSkipPolicy.java
rename to spring-batch-core/src/main/java/org/springframework/batch/core/step/skip/LimitCheckingItemSkipPolicy.java
index a83ac7d34..4912d3492 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/LimitCheckingItemSkipPolicy.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/skip/LimitCheckingItemSkipPolicy.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.batch.core.step.item;
+package org.springframework.batch.core.step.skip;
import java.io.FileNotFoundException;
import java.util.Collections;
@@ -22,7 +22,6 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import org.springframework.batch.core.ItemSkipPolicy;
import org.springframework.batch.core.Step;
import org.springframework.batch.core.StepExecution;
import org.springframework.batch.item.file.FlatFileParseException;
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/NeverSkipItemSkipPolicy.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/skip/NeverSkipItemSkipPolicy.java
similarity index 89%
rename from spring-batch-core/src/main/java/org/springframework/batch/core/step/item/NeverSkipItemSkipPolicy.java
rename to spring-batch-core/src/main/java/org/springframework/batch/core/step/skip/NeverSkipItemSkipPolicy.java
index 3584db30b..5f4591518 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/NeverSkipItemSkipPolicy.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/skip/NeverSkipItemSkipPolicy.java
@@ -13,9 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.batch.core.step.item;
+package org.springframework.batch.core.step.skip;
-import org.springframework.batch.core.ItemSkipPolicy;
/**
* {@link ItemSkipPolicy} implementation that always returns false,
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/SkipLimitExceededException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/skip/SkipLimitExceededException.java
similarity index 95%
rename from spring-batch-core/src/main/java/org/springframework/batch/core/step/item/SkipLimitExceededException.java
rename to spring-batch-core/src/main/java/org/springframework/batch/core/step/skip/SkipLimitExceededException.java
index 870fc1c5c..6d7fdc83b 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/SkipLimitExceededException.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/skip/SkipLimitExceededException.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.batch.core.step.item;
+package org.springframework.batch.core.step.skip;
import org.springframework.batch.core.UnexpectedJobExecutionException;
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/skip/package.html b/spring-batch-core/src/main/java/org/springframework/batch/core/step/skip/package.html
new file mode 100644
index 000000000..6637a1371
--- /dev/null
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/skip/package.html
@@ -0,0 +1,7 @@
+
+
+Specific implementations of skip concerns for items in a step. +
+ + diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/StepContributionTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/StepContributionTests.java index 0c15f7128..5ceea74ad 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/StepContributionTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/StepContributionTests.java @@ -17,8 +17,6 @@ package org.springframework.batch.core; import junit.framework.TestCase; -import org.springframework.batch.item.ExecutionContext; - /** * @author Dave Syer * @@ -39,18 +37,6 @@ public class StepContributionTests extends TestCase { assertEquals(1, contribution.getTaskCount()); } - /** - * Test method for - * {@link org.springframework.batch.core.StepContribution#setExecutionContext(ExecutionContext)}. - */ - public void testSetExecutionContext() { - assertEquals(null, contribution.getExecutionContext()); - ExecutionContext context = new ExecutionContext(); - context.putString("foo", "bar"); - contribution.setExecutionContext(context); - assertEquals(1, contribution.getExecutionContext().getProperties().size()); - } - /** * Test method for * {@link org.springframework.batch.core.StepContribution#incrementCommitCount()}. @@ -61,14 +47,4 @@ public class StepContributionTests extends TestCase { assertEquals(1, contribution.getCommitCount()); } - /** - * Test method for - * {@link org.springframework.batch.core.StepContribution#isTerminateOnly()}. - */ - public void testIsTerminateOnly() { - assertFalse(contribution.isTerminateOnly()); - execution.setTerminateOnly(); - assertTrue(contribution.isTerminateOnly()); - } - } diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/job/SimpleJobTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/job/SimpleJobTests.java index d75fbe375..0cf8a8676 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/job/SimpleJobTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/job/SimpleJobTests.java @@ -23,7 +23,6 @@ import java.util.Properties; import junit.framework.TestCase; import org.springframework.batch.core.BatchStatus; -import org.springframework.batch.core.ItemSkipPolicy; import org.springframework.batch.core.JobExecution; import org.springframework.batch.core.JobExecutionException; import org.springframework.batch.core.JobInstance; @@ -42,7 +41,8 @@ import org.springframework.batch.core.repository.dao.MapStepExecutionDao; import org.springframework.batch.core.repository.dao.StepExecutionDao; import org.springframework.batch.core.repository.support.SimpleJobRepository; import org.springframework.batch.core.step.AbstractStep; -import org.springframework.batch.core.step.item.NeverSkipItemSkipPolicy; +import org.springframework.batch.core.step.skip.ItemSkipPolicy; +import org.springframework.batch.core.step.skip.NeverSkipItemSkipPolicy; import org.springframework.batch.item.AbstractItemReader; import org.springframework.batch.item.ItemReader; import org.springframework.batch.item.ItemWriter; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/SimpleJvmExitCodeMapperTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/SimpleJvmExitCodeMapperTests.java index d33ce36da..e562ce2be 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/SimpleJvmExitCodeMapperTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/SimpleJvmExitCodeMapperTests.java @@ -51,38 +51,38 @@ public class SimpleJvmExitCodeMapperTests extends TestCase { public void testGetExitCodeWithpPredefinedCodes() { assertEquals( - ecm.getExitCode(ExitStatus.FINISHED.getExitCode()), + ecm.intValue(ExitStatus.FINISHED.getExitCode()), ExitCodeMapper.JVM_EXITCODE_COMPLETED); assertEquals( - ecm.getExitCode(ExitStatus.FAILED.getExitCode()), + ecm.intValue(ExitStatus.FAILED.getExitCode()), ExitCodeMapper.JVM_EXITCODE_GENERIC_ERROR); assertEquals( - ecm.getExitCode(ExitCodeMapper.JOB_NOT_PROVIDED), + ecm.intValue(ExitCodeMapper.JOB_NOT_PROVIDED), ExitCodeMapper.JVM_EXITCODE_JOB_ERROR); assertEquals( - ecm.getExitCode(ExitCodeMapper.NO_SUCH_JOB), + ecm.intValue(ExitCodeMapper.NO_SUCH_JOB), ExitCodeMapper.JVM_EXITCODE_JOB_ERROR); } public void testGetExitCodeWithPredefinedCodesOverridden() { - System.out.println(ecm2.getExitCode(ExitStatus.FINISHED.getExitCode())); + System.out.println(ecm2.intValue(ExitStatus.FINISHED.getExitCode())); assertEquals( - ecm2.getExitCode(ExitStatus.FINISHED.getExitCode()), -1); + ecm2.intValue(ExitStatus.FINISHED.getExitCode()), -1); assertEquals( - ecm2.getExitCode(ExitStatus.FAILED.getExitCode()), -2); + ecm2.intValue(ExitStatus.FAILED.getExitCode()), -2); assertEquals( - ecm2.getExitCode(ExitCodeMapper.JOB_NOT_PROVIDED), -3); + ecm2.intValue(ExitCodeMapper.JOB_NOT_PROVIDED), -3); assertEquals( - ecm2.getExitCode(ExitCodeMapper.NO_SUCH_JOB), -3); + ecm2.intValue(ExitCodeMapper.NO_SUCH_JOB), -3); } public void testGetExitCodeWithCustomCode() { - assertEquals(ecm.getExitCode("MY_CUSTOM_CODE"),3); + assertEquals(ecm.intValue("MY_CUSTOM_CODE"),3); } public void testGetExitCodeWithDefaultCode() { assertEquals( - ecm.getExitCode("UNDEFINED_CUSTOM_CODE"), + ecm.intValue("UNDEFINED_CUSTOM_CODE"), ExitCodeMapper.JVM_EXITCODE_GENERIC_ERROR); } diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/AbstractStepDaoTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/AbstractStepDaoTests.java index 86211ee87..b22da5982 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/AbstractStepDaoTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/AbstractStepDaoTests.java @@ -29,8 +29,8 @@ import org.springframework.batch.core.job.JobSupport; import org.springframework.batch.core.repository.dao.JobExecutionDao; import org.springframework.batch.core.repository.dao.JobInstanceDao; import org.springframework.batch.core.repository.dao.StepExecutionDao; +import org.springframework.batch.core.step.ExitStatusExceptionClassifier; import org.springframework.batch.core.step.StepSupport; -import org.springframework.batch.core.step.item.ExitStatusExceptionClassifier; import org.springframework.batch.item.ExecutionContext; import org.springframework.batch.repeat.ExitStatus; import org.springframework.dao.OptimisticLockingFailureException; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SimpleExitStatusExceptionClassifierTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/SimpleExitStatusExceptionClassifierTests.java similarity index 93% rename from spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SimpleExitStatusExceptionClassifierTests.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/step/SimpleExitStatusExceptionClassifierTests.java index b6e2d3cbd..be3b58745 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SimpleExitStatusExceptionClassifierTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/SimpleExitStatusExceptionClassifierTests.java @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.core.step.item; +package org.springframework.batch.core.step; import org.springframework.batch.core.JobInterruptedException; import org.springframework.batch.core.launch.support.ExitCodeMapper; import org.springframework.batch.core.repository.NoSuchJobException; -import org.springframework.batch.core.step.item.ExitStatusExceptionClassifier; -import org.springframework.batch.core.step.item.SimpleExitStatusExceptionClassifier; +import org.springframework.batch.core.step.ExitStatusExceptionClassifier; +import org.springframework.batch.core.step.SimpleExitStatusExceptionClassifier; import org.springframework.batch.repeat.ExitStatus; import junit.framework.TestCase; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/ThreadStepInterruptionPolicyTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/ThreadStepInterruptionPolicyTests.java similarity index 73% rename from spring-batch-core/src/test/java/org/springframework/batch/core/step/item/ThreadStepInterruptionPolicyTests.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/step/ThreadStepInterruptionPolicyTests.java index 0750e1c48..123f98f61 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/ThreadStepInterruptionPolicyTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/ThreadStepInterruptionPolicyTests.java @@ -13,14 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.core.step.item; +package org.springframework.batch.core.step; import junit.framework.TestCase; import org.springframework.batch.core.JobInterruptedException; -import org.springframework.batch.core.step.item.ThreadStepInterruptionPolicy; -import org.springframework.batch.repeat.RepeatContext; -import org.springframework.batch.repeat.context.RepeatContextSupport; +import org.springframework.batch.core.StepExecution; /** * @author Dave Syer @@ -29,10 +27,10 @@ import org.springframework.batch.repeat.context.RepeatContextSupport; public class ThreadStepInterruptionPolicyTests extends TestCase { ThreadStepInterruptionPolicy policy = new ThreadStepInterruptionPolicy(); - private RepeatContext context = new RepeatContextSupport(null);; + private StepExecution context = new StepExecution(new StepSupport(), null); /** - * Test method for {@link org.springframework.batch.core.executor.interrupt.ThreadStepInterruptionPolicy#checkInterrupted(org.springframework.batch.repeat.RepeatContext)}. + * Test method for {@link org.springframework.batch.core.executor.interrupt.ThreadStepInterruptionPolicy#checkInterrupted(StepExecution)}. * @throws Exception */ public void testCheckInterruptedNotComplete() throws Exception { @@ -41,7 +39,7 @@ public class ThreadStepInterruptionPolicyTests extends TestCase { } /** - * Test method for {@link org.springframework.batch.core.executor.interrupt.ThreadStepInterruptionPolicy#checkInterrupted(org.springframework.batch.repeat.RepeatContext)}. + * Test method for {@link org.springframework.batch.core.executor.interrupt.ThreadStepInterruptionPolicy#checkInterrupted(StepExecution)}. * @throws Exception */ public void testCheckInterruptedComplete() throws Exception { diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/ItemOrientedStepTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/ItemOrientedStepTests.java index a06793def..1d47ce9e7 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/ItemOrientedStepTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/ItemOrientedStepTests.java @@ -39,9 +39,9 @@ import org.springframework.batch.core.repository.dao.MapStepExecutionDao; import org.springframework.batch.core.repository.support.SimpleJobRepository; import org.springframework.batch.core.step.AbstractStep; import org.springframework.batch.core.step.JobRepositorySupport; +import org.springframework.batch.core.step.StepInterruptionPolicy; import org.springframework.batch.core.step.item.ItemOrientedStep; import org.springframework.batch.core.step.item.SimpleItemHandler; -import org.springframework.batch.core.step.item.StepInterruptionPolicy; import org.springframework.batch.item.AbstractItemReader; import org.springframework.batch.item.AbstractItemWriter; import org.springframework.batch.item.ExecutionContext; @@ -54,7 +54,6 @@ import org.springframework.batch.item.ResetFailedException; import org.springframework.batch.item.ItemStreamException; import org.springframework.batch.item.support.ListItemReader; import org.springframework.batch.repeat.ExitStatus; -import org.springframework.batch.repeat.RepeatContext; import org.springframework.batch.repeat.policy.SimpleCompletionPolicy; import org.springframework.batch.repeat.support.RepeatTemplate; import org.springframework.batch.support.PropertiesConverter; @@ -138,7 +137,7 @@ public class ItemOrientedStepTests extends TestCase { StepExecution stepExecution = new StepExecution(itemOrientedStep, jobExecution); StepContribution contribution = stepExecution.createStepContribution(); - itemOrientedStep.processChunk(contribution); + itemOrientedStep.processChunk(stepExecution, contribution); assertEquals(1, processed.size()); assertEquals(0, stepExecution.getItemCount().intValue()); assertEquals(1, contribution.getTaskCount()); @@ -470,7 +469,7 @@ public class ItemOrientedStepTests extends TestCase { StepInterruptionPolicy interruptionPolicy = new StepInterruptionPolicy() { - public void checkInterrupted(RepeatContext context) throws JobInterruptedException { + public void checkInterrupted(StepExecution stepExecution) throws JobInterruptedException { throw new JobInterruptedException("interrupted"); } }; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SkipLimitReadFailurePolicyTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SkipLimitReadFailurePolicyTests.java index 8a8a6ca19..ba6325ab4 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SkipLimitReadFailurePolicyTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SkipLimitReadFailurePolicyTests.java @@ -21,8 +21,8 @@ import java.util.List; import junit.framework.TestCase; -import org.springframework.batch.core.step.item.LimitCheckingItemSkipPolicy; -import org.springframework.batch.core.step.item.SkipLimitExceededException; +import org.springframework.batch.core.step.skip.LimitCheckingItemSkipPolicy; +import org.springframework.batch.core.step.skip.SkipLimitExceededException; import org.springframework.batch.item.file.FlatFileParseException; /** diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/StepExecutorInterruptionTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/StepExecutorInterruptionTests.java index 5490479d8..5f207b5e7 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/StepExecutorInterruptionTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/StepExecutorInterruptionTests.java @@ -29,9 +29,9 @@ import org.springframework.batch.core.repository.dao.MapJobExecutionDao; import org.springframework.batch.core.repository.dao.MapJobInstanceDao; import org.springframework.batch.core.repository.dao.MapStepExecutionDao; import org.springframework.batch.core.repository.support.SimpleJobRepository; +import org.springframework.batch.core.step.StepExecutionSynchronizer; import org.springframework.batch.core.step.item.ItemOrientedStep; import org.springframework.batch.core.step.item.SimpleItemHandler; -import org.springframework.batch.core.step.item.StepExecutionSynchronizer; import org.springframework.batch.item.AbstractItemReader; import org.springframework.batch.item.AbstractItemWriter; import org.springframework.batch.repeat.policy.SimpleCompletionPolicy; diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/step/support/NoopStepInterruptionPolicy.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/step/support/NoopStepInterruptionPolicy.java index 2541d8e56..37ae49eab 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/step/support/NoopStepInterruptionPolicy.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/step/support/NoopStepInterruptionPolicy.java @@ -1,12 +1,12 @@ package org.springframework.batch.sample.step.support; import org.springframework.batch.core.JobInterruptedException; -import org.springframework.batch.core.step.item.StepInterruptionPolicy; -import org.springframework.batch.repeat.RepeatContext; +import org.springframework.batch.core.StepExecution; +import org.springframework.batch.core.step.StepInterruptionPolicy; public class NoopStepInterruptionPolicy implements StepInterruptionPolicy { - public void checkInterrupted(RepeatContext context) + public void checkInterrupted(StepExecution stepExecution) throws JobInterruptedException { // no-op