/** * 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); }
@Test public void testMaxStatus() { assertEquals(BatchStatus.FAILED, BatchStatus.max(BatchStatus.FAILED,BatchStatus.COMPLETED)); assertEquals(BatchStatus.FAILED, BatchStatus.max(BatchStatus.COMPLETED, BatchStatus.FAILED)); assertEquals(BatchStatus.FAILED, BatchStatus.max(BatchStatus.FAILED, BatchStatus.FAILED)); assertEquals(BatchStatus.STARTED, BatchStatus.max(BatchStatus.STARTED, BatchStatus.STARTING)); assertEquals(BatchStatus.STARTED, BatchStatus.max(BatchStatus.COMPLETED, BatchStatus.STARTED)); }
execution.setStatus(BatchStatus.max(BatchStatus.STOPPED, e.getStatus())); execution.addFailureException(e); } catch (Throwable t) {
@Override public void aggregate(StepExecution result, Collection<StepExecution> executions) { Assert.notNull(result, "To aggregate into a result it must be non-null."); if (executions == null) { return; } for (StepExecution stepExecution : executions) { BatchStatus status = stepExecution.getStatus(); result.setStatus(BatchStatus.max(result.getStatus(), status)); result.setCommitCount(result.getCommitCount() + stepExecution.getCommitCount()); result.setRollbackCount(result.getRollbackCount() + stepExecution.getRollbackCount()); result.setReadCount(result.getReadCount() + stepExecution.getReadCount()); result.setReadSkipCount(result.getReadSkipCount() + stepExecution.getReadSkipCount()); result.setWriteCount(result.getWriteCount() + stepExecution.getWriteCount()); result.setWriteSkipCount(result.getWriteSkipCount() + stepExecution.getWriteSkipCount()); } } }
result.setStatus(BatchStatus.max(result.getStatus(), status)); result.setExitStatus(result.getExitStatus().and(stepExecution.getExitStatus())); result.setFilterCount(result.getFilterCount() + stepExecution.getFilterCount());
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
execution.setStatus(BatchStatus.max(BatchStatus.STOPPED, e.getStatus())); execution.addFailureException(e); } catch (Throwable t) {
execution.setStatus(BatchStatus.max(BatchStatus.STOPPED, e.getStatus())); execution.addFailureException(e); } catch (Throwable t) {
execution.setStatus(BatchStatus.max(BatchStatus.STOPPED, e.getStatus())); execution.addFailureException(e); } catch (Throwable t) {
@Override public void aggregate(StepExecution result, Collection<StepExecution> executions) { Assert.notNull(result, "To aggregate into a result it must be non-null."); if (executions == null) { return; } for (StepExecution stepExecution : executions) { BatchStatus status = stepExecution.getStatus(); result.setStatus(BatchStatus.max(result.getStatus(), status)); result.setCommitCount(result.getCommitCount() + stepExecution.getCommitCount()); result.setRollbackCount(result.getRollbackCount() + stepExecution.getRollbackCount()); result.setReadCount(result.getReadCount() + stepExecution.getReadCount()); result.setReadSkipCount(result.getReadSkipCount() + stepExecution.getReadSkipCount()); result.setWriteCount(result.getWriteCount() + stepExecution.getWriteCount()); result.setWriteSkipCount(result.getWriteSkipCount() + stepExecution.getWriteSkipCount()); } } }
@Override public void aggregate(StepExecution result, Collection<StepExecution> executions) { Assert.notNull(result, "To aggregate into a result it must be non-null."); if (executions == null) { return; } for (StepExecution stepExecution : executions) { BatchStatus status = stepExecution.getStatus(); result.setStatus(BatchStatus.max(result.getStatus(), status)); result.setCommitCount(result.getCommitCount() + stepExecution.getCommitCount()); result.setRollbackCount(result.getRollbackCount() + stepExecution.getRollbackCount()); result.setReadCount(result.getReadCount() + stepExecution.getReadCount()); result.setReadSkipCount(result.getReadSkipCount() + stepExecution.getReadSkipCount()); result.setWriteCount(result.getWriteCount() + stepExecution.getWriteCount()); result.setWriteSkipCount(result.getWriteSkipCount() + stepExecution.getWriteSkipCount()); } } }
@Override public void aggregate(StepExecution result, Collection<StepExecution> executions) { Assert.notNull(result, "To aggregate into a result it must be non-null."); if (executions == null) { return; } for (StepExecution stepExecution : executions) { BatchStatus status = stepExecution.getStatus(); result.setStatus(BatchStatus.max(result.getStatus(), status)); result.setCommitCount(result.getCommitCount() + stepExecution.getCommitCount()); result.setRollbackCount(result.getRollbackCount() + stepExecution.getRollbackCount()); result.setReadCount(result.getReadCount() + stepExecution.getReadCount()); result.setReadSkipCount(result.getReadSkipCount() + stepExecution.getReadSkipCount()); result.setWriteCount(result.getWriteCount() + stepExecution.getWriteCount()); result.setWriteSkipCount(result.getWriteSkipCount() + stepExecution.getWriteSkipCount()); } } }
/** * Aggregates the input executions into the result {@link StepExecution}. * The aggregated fields are * <ul> * <li>status - choosing the highest value using * {@link BatchStatus#max(BatchStatus, BatchStatus)}</li> * <li>exitStatus - using {@link ExitStatus#and(ExitStatus)}</li> * <li>commitCount, rollbackCount, etc. - by arithmetic sum</li> * </ul> * @see StepExecutionAggregator #aggregate(StepExecution, Collection) */ @Override public void aggregate(StepExecution result, Collection<StepExecution> executions) { Assert.notNull(result, "To aggregate into a result it must be non-null."); if (executions == null) { return; } for (StepExecution stepExecution : executions) { BatchStatus status = stepExecution.getStatus(); result.setStatus(BatchStatus.max(result.getStatus(), status)); result.setExitStatus(result.getExitStatus().and(stepExecution.getExitStatus())); result.setCommitCount(result.getCommitCount() + stepExecution.getCommitCount()); result.setRollbackCount(result.getRollbackCount() + stepExecution.getRollbackCount()); result.setReadCount(result.getReadCount() + stepExecution.getReadCount()); result.setReadSkipCount(result.getReadSkipCount() + stepExecution.getReadSkipCount()); result.setWriteCount(result.getWriteCount() + stepExecution.getWriteCount()); result.setWriteSkipCount(result.getWriteSkipCount() + stepExecution.getWriteSkipCount()); } }
/** * Aggregates the input executions into the result {@link StepExecution}. * The aggregated fields are * <ul> * <li>status - choosing the highest value using * {@link BatchStatus#max(BatchStatus, BatchStatus)}</li> * <li>exitStatus - using {@link ExitStatus#and(ExitStatus)}</li> * <li>commitCount, rollbackCount, etc. - by arithmetic sum</li> * </ul> * @see StepExecutionAggregator #aggregate(StepExecution, Collection) */ public void aggregate(StepExecution result, Collection<StepExecution> executions) { Assert.notNull(result, "To aggregate into a result it must be non-null."); if (executions == null) { return; } for (StepExecution stepExecution : executions) { BatchStatus status = stepExecution.getStatus(); result.setStatus(BatchStatus.max(result.getStatus(), status)); result.setExitStatus(result.getExitStatus().and(stepExecution.getExitStatus())); result.setCommitCount(result.getCommitCount() + stepExecution.getCommitCount()); result.setRollbackCount(result.getRollbackCount() + stepExecution.getRollbackCount()); result.setReadCount(result.getReadCount() + stepExecution.getReadCount()); result.setReadSkipCount(result.getReadSkipCount() + stepExecution.getReadSkipCount()); result.setWriteCount(result.getWriteCount() + stepExecution.getWriteCount()); result.setWriteSkipCount(result.getWriteSkipCount() + stepExecution.getWriteSkipCount()); } }
result.setStatus(BatchStatus.max(result.getStatus(), status)); result.setExitStatus(result.getExitStatus().and(stepExecution.getExitStatus())); result.setFilterCount(result.getFilterCount() + stepExecution.getFilterCount());
result.setStatus(BatchStatus.max(result.getStatus(), status)); result.setExitStatus(result.getExitStatus().and(stepExecution.getExitStatus())); result.setFilterCount(result.getFilterCount() + stepExecution.getFilterCount());