/** * Convenience method to decide if a status indicates execution was * unsuccessful. * * @return true if the status is FAILED or greater */ public boolean isUnsuccessful() { return this == FAILED || this.isGreaterThan(FAILED); }
public static BatchStatus max(BatchStatus status1, BatchStatus status2) { return status1.isGreaterThan(status2) ? status1 : status2; }
/** * Method used to move status values through their logical progression, and * override less severe failures with more severe ones. This value is * compared with the parameter and the one that has higher priority is * returned. If both are STARTED or less than the value returned is the * largest in the sequence STARTING, STARTED, COMPLETED. Otherwise the value * returned is the maximum of the two. * * @param other another status to compare to * @return either this or the other status depending on their priority */ public BatchStatus upgradeTo(BatchStatus other) { if (isGreaterThan(STARTED) || other.isGreaterThan(STARTED)) { return max(this, other); } // Both less than or equal to STARTED if (this == COMPLETED || other == COMPLETED) { return COMPLETED; } return max(this, other); }
@Override public void abandonStepExecution() { StepExecution lastStepExecution = stepExecutionHolder.get(); if (lastStepExecution != null && lastStepExecution.getStatus().isGreaterThan(BatchStatus.STOPPING)) { lastStepExecution.upgradeStatus(BatchStatus.ABANDONED); jobRepository.update(lastStepExecution); } }
if (executionId != null) { JobExecution jobExecution = jobExplorer.getJobExecution(executionId); if (jobExecution.getStatus().isGreaterThan(minStatus)) { return Arrays.asList(jobExecution); if (jobExecution.getStatus().isGreaterThan(minStatus)) { executions.add(jobExecution);
/** * Convenience method to decide if a status indicates execution was * unsuccessful. * * @return true if the status is FAILED or greater */ public boolean isUnsuccessful() { return this == FAILED || this.isGreaterThan(FAILED); }
/** * Convenience method to decide if a status indicates execution was * unsuccessful. * * @return true if the status is FAILED or greater */ public boolean isUnsuccessful() { return this == FAILED || this.isGreaterThan(FAILED); }
/** * Convenience method to decide if a status indicates execution was * unsuccessful. * * @return true if the status is FAILED or greater */ public boolean isUnsuccessful() { return this == FAILED || this.isGreaterThan(FAILED); }
/** * Determine whether the provided {@link JobExecution} is abandonable. * * @param jobExecution Must not be null and its {@link BatchStatus} must not be null * either. * @return Never returns null */ public static boolean isJobExecutionAbandonable(JobExecution jobExecution) { Assert.notNull(jobExecution, "The provided jobExecution must not be null."); final BatchStatus batchStatus = jobExecution.getStatus(); Assert.notNull(batchStatus, "The BatchStatus of the provided jobExecution must not be null."); return batchStatus.isGreaterThan(BatchStatus.STARTED) && batchStatus != BatchStatus.ABANDONED; }
private boolean isComplete(BatchStatus status) { return status.equals(BatchStatus.COMPLETED) || status.isGreaterThan(BatchStatus.STARTED); }
private boolean isComplete(BatchStatus status) { return status.equals(BatchStatus.COMPLETED) || status.isGreaterThan(BatchStatus.STARTED); }
/** * Determine whether the provided {@link JobExecution} is abandonable. * * @param jobExecution Must not be null and its {@link BatchStatus} must not be null * either. * @return Never returns null */ public static boolean isJobExecutionAbandonable(JobExecution jobExecution) { Assert.notNull(jobExecution, "The provided jobExecution must not be null."); final BatchStatus batchStatus = jobExecution.getStatus(); Assert.notNull(batchStatus, "The BatchStatus of the provided jobExecution must not be null."); return batchStatus.isGreaterThan(BatchStatus.STARTED) && batchStatus != BatchStatus.ABANDONED; }
/** * Determine whether the provided {@link JobExecution} is restartable. * * @param jobExecution Must not be null and its {@link BatchStatus} must not be null * either. * @return Never returns null */ public static boolean isJobExecutionRestartable(JobExecution jobExecution) { Assert.notNull(jobExecution, "The provided jobExecution must not be null."); final BatchStatus batchStatus = jobExecution.getStatus(); Assert.notNull(batchStatus, "The BatchStatus of the provided jobExecution must not be null."); return batchStatus.isGreaterThan(BatchStatus.STOPPING) && batchStatus.isLessThan(BatchStatus.ABANDONED); }
/** * Determine whether the provided {@link JobExecution} is restartable. * * @param jobExecution Must not be null and its {@link BatchStatus} must not be null * either. * @return Never returns null */ public static boolean isJobExecutionRestartable(JobExecution jobExecution) { Assert.notNull(jobExecution, "The provided jobExecution must not be null."); final BatchStatus batchStatus = jobExecution.getStatus(); Assert.notNull(batchStatus, "The BatchStatus of the provided jobExecution must not be null."); return batchStatus.isGreaterThan(BatchStatus.STOPPING) && batchStatus.isLessThan(BatchStatus.ABANDONED); }
private List<JobExecution> getJobExecutionsWithStatusGreaterThan(String jobName, CommandLineOptions option, BatchStatus minStatus) { return option.getId().map(jobExplorer::getJobExecution) .map(s -> s.getStatus().isGreaterThan(minStatus) ? Collections.singletonList(s) : null) .orElse(getJobExecutionsWithStatusGreaterThan(jobName, minStatus)); }
@Override public void abandonStepExecution() { StepExecution lastStepExecution = stepExecutionHolder.get(); if (lastStepExecution != null && lastStepExecution.getStatus().isGreaterThan(BatchStatus.STOPPING)) { lastStepExecution.upgradeStatus(BatchStatus.ABANDONED); jobRepository.update(lastStepExecution); } }
@Override public void abandonStepExecution() { StepExecution lastStepExecution = stepExecutionHolder.get(); if (lastStepExecution != null && lastStepExecution.getStatus().isGreaterThan(BatchStatus.STOPPING)) { lastStepExecution.upgradeStatus(BatchStatus.ABANDONED); jobRepository.update(lastStepExecution); } }
@Override public void abandonStepExecution() { StepExecution lastStepExecution = stepExecutionHolder.get(); if (lastStepExecution != null && lastStepExecution.getStatus().isGreaterThan(BatchStatus.STOPPING)) { lastStepExecution.upgradeStatus(BatchStatus.ABANDONED); jobRepository.update(lastStepExecution); } }
public void abandonStepExecution() { StepExecution lastStepExecution = stepExecutionHolder.get(); if (lastStepExecution != null && lastStepExecution.getStatus().isGreaterThan(BatchStatus.STOPPING)) { lastStepExecution.upgradeStatus(BatchStatus.ABANDONED); jobRepository.update(lastStepExecution); } }
void stopStaleProcess(final JobExecution jobExecution) { final BatchStatus status = jobExecution.getStatus(); if (status.isGreaterThan(BatchStatus.STOPPING)) { return; } jobExecution.setStatus(BatchStatus.STOPPED); jobExecution.setEndTime(new Date()); jobRepository.update(jobExecution); }