OPEN - issue BATCH-378: RepeatListener is confusing and too generic to use for 'intercepting' a step

http://jira.springframework.org/browse/BATCH-378

Remove unnecessary listener implementations and migrate some functionality to samples.  In the process discovered that tasklet steps cannot be stopped.
This commit is contained in:
dsyer
2008-02-28 11:41:49 +00:00
parent 707e94b3c8
commit 2a25a7a636
16 changed files with 183 additions and 358 deletions

View File

@@ -55,11 +55,13 @@ public class BatchStatus implements Serializable {
public static final BatchStatus FAILED = new BatchStatus("FAILED");
public static final BatchStatus STOPPING = new BatchStatus("STOPPING");
public static final BatchStatus STOPPED = new BatchStatus("STOPPED");
public static final BatchStatus UNKNOWN = new BatchStatus("UNKNOWN");
private static final BatchStatus[] VALUES = { STARTING, STARTED, COMPLETED, FAILED, STOPPED, UNKNOWN };
private static final BatchStatus[] VALUES = { STARTING, STARTED, COMPLETED, FAILED, STOPPING, STOPPED, UNKNOWN };
/**
* Given a string representation of a status, return the appropriate BatchStatus.

View File

@@ -66,7 +66,7 @@ public class JobExecution extends Entity {
public JobExecution(JobInstance job) {
this(job, null);
}
public Date getEndTime() {
return endTime;
}
@@ -124,7 +124,7 @@ public class JobExecution extends Entity {
public JobInstance getJobInstance() {
return jobInstance;
}
public void setJobInstance(JobInstance jobInstance) {
this.jobInstance = jobInstance;
}
@@ -164,7 +164,16 @@ public class JobExecution extends Entity {
* @return true if the end time is null
*/
public boolean isRunning() {
return endTime == null && !(BatchStatus.STOPPED==status);
return endTime == null;
}
/**
* Test if this {@link JobExecution} indicates that it has been signalled to
* stop.
* @return true if the status is {@link BatchStatus#STOPPING}
*/
public boolean isStopping() {
return status == BatchStatus.STOPPING;
}
/**
@@ -177,6 +186,6 @@ public class JobExecution extends Entity {
StepExecution stepExecution = (StepExecution) it.next();
stepExecution.setTerminateOnly();
}
status = BatchStatus.STOPPED;
status = BatchStatus.STOPPING;
}
}