|
|
|
|
@@ -41,19 +41,19 @@ public class JdbcStepExecutionDao extends AbstractJdbcBatchMetadataDao implement
|
|
|
|
|
private static final Log logger = LogFactory.getLog(JdbcStepExecutionDao.class);
|
|
|
|
|
|
|
|
|
|
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, ITEM_COUNT, CONTINUABLE, EXIT_CODE, EXIT_MESSAGE, READ_SKIP_COUNT, WRITE_SKIP_COUNT, ROLLBACK_COUNT, LAST_UPDATED) "
|
|
|
|
|
+ "values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
|
|
|
|
+ "END_TIME, STATUS, COMMIT_COUNT, READ_COUNT, FILTER_COUNT, WRITE_COUNT, CONTINUABLE, EXIT_CODE, EXIT_MESSAGE, READ_SKIP_COUNT, WRITE_SKIP_COUNT, ROLLBACK_COUNT, LAST_UPDATED) "
|
|
|
|
|
+ "values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
|
|
|
|
|
|
|
|
|
private static final String UPDATE_STEP_EXECUTION = "UPDATE %PREFIX%STEP_EXECUTION set START_TIME = ?, END_TIME = ?, "
|
|
|
|
|
+ "STATUS = ?, COMMIT_COUNT = ?, ITEM_COUNT = ?, CONTINUABLE = ? , EXIT_CODE = ?, "
|
|
|
|
|
+ "EXIT_MESSAGE = ?, VERSION = ?, READ_SKIP_COUNT = ?, WRITE_SKIP_COUNT = ?, ROLLBACK_COUNT = ?, LAST_UPDATED = ?" +
|
|
|
|
|
" where STEP_EXECUTION_ID = ? and VERSION = ?";
|
|
|
|
|
+ "STATUS = ?, COMMIT_COUNT = ?, READ_COUNT = ?, FILTER_COUNT = ?, WRITE_COUNT = ?, CONTINUABLE = ? , EXIT_CODE = ?, "
|
|
|
|
|
+ "EXIT_MESSAGE = ?, VERSION = ?, READ_SKIP_COUNT = ?, WRITE_SKIP_COUNT = ?, ROLLBACK_COUNT = ?, LAST_UPDATED = ?"
|
|
|
|
|
+ " where STEP_EXECUTION_ID = ? and VERSION = ?";
|
|
|
|
|
|
|
|
|
|
private static final String GET_RAW_STEP_EXECUTIONS = "SELECT STEP_EXECUTION_ID, STEP_NAME, START_TIME, END_TIME, STATUS, COMMIT_COUNT,"
|
|
|
|
|
+ " ITEM_COUNT, CONTINUABLE, EXIT_CODE, EXIT_MESSAGE, READ_SKIP_COUNT, WRITE_SKIP_COUNT, ROLLBACK_COUNT, LAST_UPDATED from %PREFIX%STEP_EXECUTION where JOB_EXECUTION_ID = ?";
|
|
|
|
|
+ " READ_COUNT, FILTER_COUNT, WRITE_COUNT, CONTINUABLE, EXIT_CODE, EXIT_MESSAGE, READ_SKIP_COUNT, WRITE_SKIP_COUNT, ROLLBACK_COUNT, LAST_UPDATED from %PREFIX%STEP_EXECUTION where JOB_EXECUTION_ID = ?";
|
|
|
|
|
|
|
|
|
|
private static final String GET_STEP_EXECUTIONS = GET_RAW_STEP_EXECUTIONS + " order by STEP_EXECUTION_ID";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static final String GET_STEP_EXECUTION = GET_RAW_STEP_EXECUTIONS + " and STEP_NAME = ?";
|
|
|
|
|
|
|
|
|
|
private static final String CURRENT_VERSION_STEP_EXECUTION = "SELECT VERSION FROM %PREFIX%STEP_EXECUTION WHERE STEP_EXECUTION_ID=?";
|
|
|
|
|
@@ -105,15 +105,17 @@ 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.getItemCount(), stepExecution.getExitStatus().isContinuable() ? "Y" : "N",
|
|
|
|
|
stepExecution.getExitStatus().getExitCode(), exitDescription, stepExecution.getReadSkipCount(),
|
|
|
|
|
stepExecution.getWriteSkipCount(), stepExecution.getRollbackCount(), stepExecution.getLastUpdated() };
|
|
|
|
|
stepExecution.getReadCount(), stepExecution.getFilterCount(), stepExecution.getWriteCount(),
|
|
|
|
|
stepExecution.getExitStatus().isContinuable() ? "Y" : "N", stepExecution.getExitStatus().getExitCode(),
|
|
|
|
|
exitDescription, stepExecution.getReadSkipCount(), stepExecution.getWriteSkipCount(),
|
|
|
|
|
stepExecution.getRollbackCount(), stepExecution.getLastUpdated() };
|
|
|
|
|
getJdbcTemplate().getJdbcOperations().update(
|
|
|
|
|
getQuery(SAVE_STEP_EXECUTION),
|
|
|
|
|
parameters,
|
|
|
|
|
new int[] { Types.INTEGER, Types.INTEGER, Types.VARCHAR, Types.INTEGER, Types.TIMESTAMP,
|
|
|
|
|
Types.TIMESTAMP, Types.VARCHAR, Types.INTEGER, Types.INTEGER, Types.CHAR, Types.VARCHAR,
|
|
|
|
|
Types.VARCHAR, Types.INTEGER, Types.INTEGER, Types.INTEGER, Types.TIMESTAMP });
|
|
|
|
|
Types.TIMESTAMP, Types.VARCHAR, Types.INTEGER, Types.INTEGER, Types.INTEGER, Types.INTEGER,
|
|
|
|
|
Types.CHAR, Types.VARCHAR, Types.VARCHAR, Types.INTEGER, Types.INTEGER, Types.INTEGER,
|
|
|
|
|
Types.TIMESTAMP });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@@ -132,7 +134,9 @@ public class JdbcStepExecutionDao extends AbstractJdbcBatchMetadataDao implement
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* (non-Javadoc)
|
|
|
|
|
* @see org.springframework.batch.execution.repository.dao.StepExecutionDao#updateStepExecution(org.springframework.batch.core.domain.StepExecution)
|
|
|
|
|
*
|
|
|
|
|
* @seeorg.springframework.batch.execution.repository.dao.StepExecutionDao#
|
|
|
|
|
* updateStepExecution(org.springframework.batch.core.domain.StepExecution)
|
|
|
|
|
*/
|
|
|
|
|
public void updateStepExecution(StepExecution stepExecution) {
|
|
|
|
|
|
|
|
|
|
@@ -151,18 +155,21 @@ 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.getItemCount(),
|
|
|
|
|
stepExecution.getStatus().toString(), stepExecution.getCommitCount(), stepExecution.getReadCount(),
|
|
|
|
|
stepExecution.getFilterCount(), stepExecution.getWriteCount(),
|
|
|
|
|
stepExecution.getExitStatus().isContinuable() ? "Y" : "N",
|
|
|
|
|
stepExecution.getExitStatus().getExitCode(), exitDescription, version,
|
|
|
|
|
stepExecution.getReadSkipCount(), stepExecution.getWriteSkipCount(),
|
|
|
|
|
stepExecution.getRollbackCount(), stepExecution.getLastUpdated(), stepExecution.getId(),
|
|
|
|
|
stepExecution.getRollbackCount(), stepExecution.getLastUpdated(), stepExecution.getId(),
|
|
|
|
|
stepExecution.getVersion() };
|
|
|
|
|
int count = getJdbcTemplate().getJdbcOperations().update(
|
|
|
|
|
getQuery(UPDATE_STEP_EXECUTION),
|
|
|
|
|
parameters,
|
|
|
|
|
new int[] { Types.TIMESTAMP, Types.TIMESTAMP, Types.VARCHAR, Types.INTEGER, Types.INTEGER,
|
|
|
|
|
Types.CHAR, Types.VARCHAR, Types.VARCHAR, Types.INTEGER, Types.INTEGER, Types.INTEGER,
|
|
|
|
|
Types.INTEGER, Types.TIMESTAMP, Types.INTEGER, Types.INTEGER });
|
|
|
|
|
int count = getJdbcTemplate().getJdbcOperations()
|
|
|
|
|
.update(
|
|
|
|
|
getQuery(UPDATE_STEP_EXECUTION),
|
|
|
|
|
parameters,
|
|
|
|
|
new int[] { Types.TIMESTAMP, Types.TIMESTAMP, Types.VARCHAR, Types.INTEGER, Types.INTEGER,
|
|
|
|
|
Types.INTEGER, Types.INTEGER, Types.CHAR, Types.VARCHAR, Types.VARCHAR,
|
|
|
|
|
Types.INTEGER, Types.INTEGER, Types.INTEGER, Types.INTEGER, Types.TIMESTAMP,
|
|
|
|
|
Types.INTEGER, Types.INTEGER });
|
|
|
|
|
|
|
|
|
|
// Avoid concurrent modifications...
|
|
|
|
|
if (count == 0) {
|
|
|
|
|
@@ -207,13 +214,13 @@ public class JdbcStepExecutionDao extends AbstractJdbcBatchMetadataDao implement
|
|
|
|
|
return (StepExecution) executions.get(0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<StepExecution> getStepExecutions(JobExecution jobExecution) {
|
|
|
|
|
List<StepExecution> executions = getJdbcTemplate().query(getQuery(GET_STEP_EXECUTIONS),
|
|
|
|
|
new StepExecutionRowMapper(jobExecution), jobExecution.getId());
|
|
|
|
|
return executions;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private class StepExecutionRowMapper implements ParameterizedRowMapper<StepExecution> {
|
|
|
|
|
|
|
|
|
|
private final JobExecution jobExecution;
|
|
|
|
|
@@ -228,15 +235,17 @@ public class JdbcStepExecutionDao extends AbstractJdbcBatchMetadataDao implement
|
|
|
|
|
stepExecution.setEndTime(rs.getTimestamp(4));
|
|
|
|
|
stepExecution.setStatus(BatchStatus.valueOf(rs.getString(5)));
|
|
|
|
|
stepExecution.setCommitCount(rs.getInt(6));
|
|
|
|
|
stepExecution.setItemCount(rs.getInt(7));
|
|
|
|
|
stepExecution.setExitStatus(new ExitStatus("Y".equals(rs.getString(8)), rs.getString(9), rs.getString(10)));
|
|
|
|
|
stepExecution.setReadSkipCount(rs.getInt(11));
|
|
|
|
|
stepExecution.setWriteSkipCount(rs.getInt(12));
|
|
|
|
|
stepExecution.setRollbackCount(rs.getInt(13));
|
|
|
|
|
stepExecution.setLastUpdated(rs.getTimestamp(14));
|
|
|
|
|
stepExecution.setReadCount(rs.getInt(7));
|
|
|
|
|
stepExecution.setFilterCount(rs.getInt(8));
|
|
|
|
|
stepExecution.setWriteCount(rs.getInt(9));
|
|
|
|
|
stepExecution.setExitStatus(new ExitStatus("Y".equals(rs.getString(10)), rs.getString(11), rs.getString(12)));
|
|
|
|
|
stepExecution.setReadSkipCount(rs.getInt(13));
|
|
|
|
|
stepExecution.setWriteSkipCount(rs.getInt(14));
|
|
|
|
|
stepExecution.setRollbackCount(rs.getInt(15));
|
|
|
|
|
stepExecution.setLastUpdated(rs.getTimestamp(16));
|
|
|
|
|
return stepExecution;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|