@Override public Date getStartTime() { return stepExecution.getStartTime(); }
/** * Validate StepExecution. At a minimum, JobId, StartTime, and Status cannot * be null. EndTime can be null for an unfinished job. * * @throws IllegalArgumentException */ private void validateStepExecution(StepExecution stepExecution) { Assert.notNull(stepExecution, "stepExecution is required"); Assert.notNull(stepExecution.getStepName(), "StepExecution step name cannot be null."); Assert.notNull(stepExecution.getStartTime(), "StepExecution start time cannot be null."); Assert.notNull(stepExecution.getStatus(), "StepExecution status cannot be null."); }
latest = stepExecution; if (latest.getStartTime().getTime() < stepExecution.getStartTime().getTime()) { latest = stepExecution; if (latest.getStartTime().getTime() == stepExecution.getStartTime().getTime() && latest.getId() < stepExecution.getId()) { latest = stepExecution;
/** * Test method for * {@link org.springframework.batch.core.JobExecution#getStartTime()}. */ @Test public void testGetStartTime() { assertNotNull(execution.getStartTime()); execution.setStartTime(new Date(10L)); assertEquals(10L, execution.getStartTime().getTime()); }
private List<Object[]> buildStepExecutionParameters(StepExecution stepExecution) { Assert.isNull(stepExecution.getId(), "to-be-saved (not updated) StepExecution can't already have an id assigned"); Assert.isNull(stepExecution.getVersion(), "to-be-saved (not updated) StepExecution can't already have a version assigned"); validateStepExecution(stepExecution); stepExecution.setId(stepExecutionIncrementer.nextLongValue()); stepExecution.incrementVersion(); //Should be 0 List<Object[]> parameters = new ArrayList<>(); String exitDescription = truncateExitDescription(stepExecution.getExitStatus().getExitDescription()); Object[] parameterValues = new Object[] { stepExecution.getId(), stepExecution.getVersion(), stepExecution.getStepName(), stepExecution.getJobExecutionId(), stepExecution.getStartTime(), stepExecution.getEndTime(), stepExecution.getStatus().toString(), stepExecution.getCommitCount(), stepExecution.getReadCount(), stepExecution.getFilterCount(), stepExecution.getWriteCount(), stepExecution.getExitStatus().getExitCode(), exitDescription, stepExecution.getReadSkipCount(), stepExecution.getWriteSkipCount(), stepExecution.getProcessSkipCount(), stepExecution.getRollbackCount(), stepExecution.getLastUpdated() }; Integer[] parameterTypes = new Integer[] { Types.BIGINT, Types.INTEGER, Types.VARCHAR, Types.BIGINT, Types.TIMESTAMP, Types.TIMESTAMP, Types.VARCHAR, Types.INTEGER, Types.INTEGER, Types.INTEGER, Types.INTEGER, Types.VARCHAR, Types.VARCHAR, Types.INTEGER, Types.INTEGER, Types.INTEGER, Types.INTEGER, Types.TIMESTAMP }; parameters.add(0, Arrays.copyOf(parameterValues,parameterValues.length)); parameters.add(1, Arrays.copyOf(parameterTypes,parameterTypes.length)); return parameters; }
Object[] parameters = new Object[] { stepExecution.getStartTime(), stepExecution.getEndTime(), stepExecution.getStatus().toString(), stepExecution.getCommitCount(), stepExecution.getReadCount(), stepExecution.getFilterCount(), stepExecution.getWriteCount(),
private void assertStepExecutionsAreEqual(StepExecution expected, StepExecution actual) { assertEquals(expected.getId(), actual.getId()); assertEquals(expected.getStartTime(), actual.getStartTime()); assertEquals(expected.getEndTime(), actual.getEndTime()); assertEquals(expected.getSkipCount(), actual.getSkipCount()); assertEquals(expected.getCommitCount(), actual.getCommitCount()); assertEquals(expected.getReadCount(), actual.getReadCount()); assertEquals(expected.getWriteCount(), actual.getWriteCount()); assertEquals(expected.getFilterCount(), actual.getFilterCount()); assertEquals(expected.getWriteSkipCount(), actual.getWriteSkipCount()); assertEquals(expected.getReadSkipCount(), actual.getReadSkipCount()); assertEquals(expected.getProcessSkipCount(), actual.getProcessSkipCount()); assertEquals(expected.getRollbackCount(), actual.getRollbackCount()); assertEquals(expected.getExitStatus(), actual.getExitStatus()); assertEquals(expected.getLastUpdated(), actual.getLastUpdated()); assertEquals(expected.getExitStatus(), actual.getExitStatus()); assertEquals(expected.getJobExecutionId(), actual.getJobExecutionId()); }
private void assertStepExecutionsAreEqual(StepExecution expected, StepExecution actual) { assertEquals(expected.getId(), actual.getId()); assertEquals(expected.getStartTime(), actual.getStartTime()); assertEquals(expected.getEndTime(), actual.getEndTime()); assertEquals(expected.getSkipCount(), actual.getSkipCount()); assertEquals(expected.getCommitCount(), actual.getCommitCount()); assertEquals(expected.getReadCount(), actual.getReadCount()); assertEquals(expected.getWriteCount(), actual.getWriteCount()); assertEquals(expected.getFilterCount(), actual.getFilterCount()); assertEquals(expected.getWriteSkipCount(), actual.getWriteSkipCount()); assertEquals(expected.getReadSkipCount(), actual.getReadSkipCount()); assertEquals(expected.getProcessSkipCount(), actual.getProcessSkipCount()); assertEquals(expected.getRollbackCount(), actual.getRollbackCount()); assertEquals(expected.getExitStatus(), actual.getExitStatus()); assertEquals(expected.getLastUpdated(), actual.getLastUpdated()); assertEquals(expected.getExitStatus(), actual.getExitStatus()); assertEquals(expected.getJobExecutionId(), actual.getJobExecutionId()); } }
@Override public Date getStartTime() { return stepExecution.getStartTime(); }
@Override public Date getStartTime() { return stepExecution.getStartTime(); }
@Override public Date getStartTime() { return stepExecution.getStartTime(); }
/** * Validate StepExecution. At a minimum, JobId, StartTime, and Status cannot * be null. EndTime can be null for an unfinished job. * * @throws IllegalArgumentException */ private void validateStepExecution(StepExecution stepExecution) { Assert.notNull(stepExecution, "stepExecution is required"); Assert.notNull(stepExecution.getStepName(), "StepExecution step name cannot be null."); Assert.notNull(stepExecution.getStartTime(), "StepExecution start time cannot be null."); Assert.notNull(stepExecution.getStatus(), "StepExecution status cannot be null."); }
private void validateStepExecution(StepExecution stepExecution) { Assert.notNull(stepExecution); Assert.notNull(stepExecution.getStepName(), "StepExecution step name cannot be null."); Assert.notNull(stepExecution.getStartTime(), "StepExecution start time cannot be null."); Assert.notNull(stepExecution.getStatus(), "StepExecution status cannot be null."); }
/** * Validate StepExecution. At a minimum, JobId, StartTime, and Status cannot * be null. EndTime can be null for an unfinished job. * * @throws IllegalArgumentException */ private void validateStepExecution(StepExecution stepExecution) { Assert.notNull(stepExecution); Assert.notNull(stepExecution.getStepName(), "StepExecution step name cannot be null."); Assert.notNull(stepExecution.getStartTime(), "StepExecution start time cannot be null."); Assert.notNull(stepExecution.getStatus(), "StepExecution status cannot be null."); }
public double getLatestDuration() { StepExecution stepExecution = getLatestStepExecution(stepName); if (stepExecution==null) { return 0; } Date endTime = stepExecution.getEndTime(); return (endTime != null ? endTime.getTime() : System.currentTimeMillis()) - stepExecution.getStartTime().getTime(); }
@Override public ExitStatus afterStep(final StepExecution stepExecution) { final long startTime = stepExecution.getStartTime().getTime(); final long endTime = System.currentTimeMillis(); final long duration = endTime - startTime; logger.debug("Step Finished {} in [{}ms]", stepExecution.getStepName(), duration); return stepExecution.getExitStatus(); }
/** * Validate StepExecution. At a minimum, JobId, StartTime, and Status cannot * be null. EndTime can be null for an unfinished job. * * @throws IllegalArgumentException */ private void validateStepExecution(StepExecution stepExecution) { Assert.notNull(stepExecution); Assert.notNull(stepExecution.getStepName(), "StepExecution step name cannot be null."); Assert.notNull(stepExecution.getStartTime(), "StepExecution start time cannot be null."); Assert.notNull(stepExecution.getStatus(), "StepExecution status cannot be null."); }
/** * Validate StepExecution. At a minimum, JobId, StartTime, and Status cannot * be null. EndTime can be null for an unfinished job. * * @throws IllegalArgumentException */ private void validateStepExecution(StepExecution stepExecution) { Assert.notNull(stepExecution, "stepExecution is required"); Assert.notNull(stepExecution.getStepName(), "StepExecution step name cannot be null."); Assert.notNull(stepExecution.getStartTime(), "StepExecution start time cannot be null."); Assert.notNull(stepExecution.getStatus(), "StepExecution status cannot be null."); }
private void writeJobExecutionStatus(JobExecution jobExecution, JobParameters jobParameters) { StepExecution step = jobExecution.getStepExecutions().toArray(new StepExecution[]{})[0]; String schemaName = jobParameters.getString("schemaName"); logger.info(String.format("Written %d ddls with user objects from total %d in schema %s", step.getWriteCount(), step.getReadCount(), schemaName)); logger.info(String.format("Skip processing %d user objects from total %d in schema %s", step.getFilterCount(), step.getReadCount(), schemaName)); long seconds = ((step.getEndTime().getTime()-step.getStartTime().getTime())/1000); logger.info(String.format("scheme2ddl of schema %s %s in %d seconds", schemaName, jobExecution.getStatus().toString().toLowerCase(), seconds)); }
private void executionTimeLog(JobExecution jobExecution) { if (!log.isDebugEnabled()) { return; } log.debug("Execution time {}(JobExecutionId:{} status:{}) in {} ms", jobExecution.getJobInstance().getJobName(), jobExecution.getJobInstance().getId(), jobExecution.getStatus(), jobExecution.getEndTime().getTime() - jobExecution.getStartTime().getTime()); jobExecution.getStepExecutions().forEach(s -> log.debug("Execution time {} in {} ms", s.getStepName(), s.getEndTime().getTime() - s.getStartTime().getTime()) ); }