RESOLVED - issue BATCH-446: taskCount in StepExecution should be itemCount
http://jira.springframework.org/browse/BATCH-446
This commit is contained in:
@@ -42,7 +42,7 @@ public class StepExecution extends Entity {
|
||||
|
||||
private BatchStatus status = BatchStatus.STARTING;
|
||||
|
||||
private int taskCount = 0;
|
||||
private int itemCount = 0;
|
||||
|
||||
private int commitCount = 0;
|
||||
|
||||
@@ -104,7 +104,7 @@ public class StepExecution extends Entity {
|
||||
* Increments the number of tasks in this execution
|
||||
*/
|
||||
public void incrementTaskCount() {
|
||||
taskCount++;
|
||||
itemCount++;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -166,17 +166,17 @@ public class StepExecution extends Entity {
|
||||
*
|
||||
* @return the current number of tasks for this execution
|
||||
*/
|
||||
public Integer getTaskCount() {
|
||||
return new Integer(taskCount);
|
||||
public Integer getItemCount() {
|
||||
return new Integer(itemCount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the current number of tasks for this execution
|
||||
*
|
||||
* @param taskCount the current number of tasks for this execution
|
||||
* @param itemCount the current number of tasks for this execution
|
||||
*/
|
||||
public void setTaskCount(int taskCount) {
|
||||
this.taskCount = taskCount;
|
||||
public void setItemCount(int itemCount) {
|
||||
this.itemCount = itemCount;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -283,7 +283,7 @@ public class StepExecution extends Entity {
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return super.toString() + ", name=" + step.getName() + ", taskCount=" + taskCount + ", commitCount="
|
||||
return super.toString() + ", name=" + step.getName() + ", itemCount=" + itemCount + ", commitCount="
|
||||
+ commitCount + ", rollbackCount=" + rollbackCount;
|
||||
}
|
||||
|
||||
@@ -328,7 +328,7 @@ public class StepExecution extends Entity {
|
||||
* @param contribution
|
||||
*/
|
||||
public synchronized void apply(StepContribution contribution) {
|
||||
taskCount += contribution.getTaskCount();
|
||||
itemCount += contribution.getTaskCount();
|
||||
// TODO: this should not be necessary - the step decides
|
||||
// executionContext = contribution.getExecutionContext();
|
||||
commitCount += contribution.getCommitCount();
|
||||
|
||||
@@ -62,18 +62,18 @@ public class JdbcStepExecutionDao extends AbstractJdbcBatchMetadataDao implement
|
||||
+ " KEY_NAME, STRING_VAL, DOUBLE_VAL, LONG_VAL, OBJECT_VAL) values(?,?,?,?,?,?,?)";
|
||||
|
||||
private static final String SAVE_STEP_EXECUTION = "INSERT into %PREFIX%STEP_EXECUTION(STEP_EXECUTION_ID, VERSION, STEP_NAME, JOB_EXECUTION_ID, START_TIME, "
|
||||
+ "END_TIME, STATUS, COMMIT_COUNT, TASK_COUNT, CONTINUABLE, EXIT_CODE, EXIT_MESSAGE) "
|
||||
+ "END_TIME, STATUS, COMMIT_COUNT, ITEM_COUNT, CONTINUABLE, EXIT_CODE, EXIT_MESSAGE) "
|
||||
+ "values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
||||
|
||||
private static final String UPDATE_STEP_EXECUTION_CONTEXT = "UPDATE %PREFIX%STEP_EXECUTION_CONTEXT set "
|
||||
+ "TYPE_CD = ?, STRING_VAL = ?, DOUBLE_VAL = ?, LONG_VAL = ?, OBJECT_VAL = ? where STEP_EXECUTION_ID = ? and KEY_NAME = ?";
|
||||
|
||||
private static final String UPDATE_STEP_EXECUTION = "UPDATE %PREFIX%STEP_EXECUTION set START_TIME = ?, END_TIME = ?, "
|
||||
+ "STATUS = ?, COMMIT_COUNT = ?, TASK_COUNT = ?, CONTINUABLE = ? , EXIT_CODE = ?, "
|
||||
+ "STATUS = ?, COMMIT_COUNT = ?, ITEM_COUNT = ?, CONTINUABLE = ? , EXIT_CODE = ?, "
|
||||
+ "EXIT_MESSAGE = ?, VERSION = ? where STEP_EXECUTION_ID = ? and VERSION = ?";
|
||||
|
||||
private static final String GET_STEP_EXECUTION = "SELECT STEP_EXECUTION_ID, STEP_NAME, START_TIME, END_TIME, STATUS, COMMIT_COUNT,"
|
||||
+ " TASK_COUNT, CONTINUABLE, EXIT_CODE, EXIT_MESSAGE from %PREFIX%STEP_EXECUTION where STEP_NAME = ? and JOB_EXECUTION_ID = ?";
|
||||
+ " ITEM_COUNT, CONTINUABLE, EXIT_CODE, EXIT_MESSAGE from %PREFIX%STEP_EXECUTION where STEP_NAME = ? and JOB_EXECUTION_ID = ?";
|
||||
|
||||
private static final String CURRENT_VERSION_STEP_EXECUTION = "SELECT VERSION FROM %PREFIX%STEP_EXECUTION WHERE STEP_EXECUTION_ID=?";
|
||||
|
||||
@@ -179,7 +179,7 @@ public class JdbcStepExecutionDao extends AbstractJdbcBatchMetadataDao implement
|
||||
Object[] parameters = new Object[] { stepExecution.getId(), stepExecution.getVersion(),
|
||||
stepExecution.getStepName(), stepExecution.getJobExecutionId(), stepExecution.getStartTime(),
|
||||
stepExecution.getEndTime(), stepExecution.getStatus().toString(), stepExecution.getCommitCount(),
|
||||
stepExecution.getTaskCount(), stepExecution.getExitStatus().isContinuable() ? "Y" : "N",
|
||||
stepExecution.getItemCount(), stepExecution.getExitStatus().isContinuable() ? "Y" : "N",
|
||||
stepExecution.getExitStatus().getExitCode(), stepExecution.getExitStatus().getExitDescription() };
|
||||
getJdbcTemplate().update(
|
||||
getQuery(SAVE_STEP_EXECUTION),
|
||||
@@ -312,7 +312,7 @@ public class JdbcStepExecutionDao extends AbstractJdbcBatchMetadataDao implement
|
||||
|
||||
Integer version = new Integer(stepExecution.getVersion().intValue() + 1);
|
||||
Object[] parameters = new Object[] { stepExecution.getStartTime(), stepExecution.getEndTime(),
|
||||
stepExecution.getStatus().toString(), stepExecution.getCommitCount(), stepExecution.getTaskCount(),
|
||||
stepExecution.getStatus().toString(), stepExecution.getCommitCount(), stepExecution.getItemCount(),
|
||||
stepExecution.getExitStatus().isContinuable() ? "Y" : "N",
|
||||
stepExecution.getExitStatus().getExitCode(), exitDescription, version, stepExecution.getId(),
|
||||
stepExecution.getVersion() };
|
||||
@@ -354,7 +354,7 @@ public class JdbcStepExecutionDao extends AbstractJdbcBatchMetadataDao implement
|
||||
stepExecution.setEndTime(rs.getTimestamp(4));
|
||||
stepExecution.setStatus(BatchStatus.getStatus(rs.getString(5)));
|
||||
stepExecution.setCommitCount(rs.getInt(6));
|
||||
stepExecution.setTaskCount(rs.getInt(7));
|
||||
stepExecution.setItemCount(rs.getInt(7));
|
||||
stepExecution.setExitStatus(new ExitStatus("Y".equals(rs.getString(8)), rs.getString(9), rs.getString(10)));
|
||||
stepExecution.setExecutionContext(findExecutionContext(stepExecution));
|
||||
return stepExecution;
|
||||
|
||||
Reference in New Issue
Block a user