private void transitionToFinalStatus() { BatchStatus currentBatchStatus = stepContext.getBatchStatus(); if (currentBatchStatus.equals(BatchStatus.STARTING)) { throw new IllegalStateException("Step batch status should not be in a STARTING state"); } // Transition to "COMPLETED" if (currentBatchStatus.equals(BatchStatus.STARTED)) { if (logger.isLoggable(Level.FINE)) { logger.fine("Transitioning step status to COMPLETED for step: " + step.getId()); } statusCompleted(); // Transition to "STOPPED" } else if (currentBatchStatus.equals(BatchStatus.STOPPING)) { if (logger.isLoggable(Level.FINE)) { logger.fine("Transitioning step status to STOPPED for step: " + step.getId()); } statusStopped(); } }
if (stepBatchStatus.equals(BatchStatus.COMPLETED)) {
if (batchStatus.equals(BatchStatus.FAILED)) { if (logger.isLoggable(Level.FINE)) { logger.fine("Subjob " + subJob.getJobExecution().getExecutionId() + "ended with status '" + batchStatus + "'" ); } else if (batchStatus.equals(BatchStatus.STOPPED)){ if (logger.isLoggable(Level.FINE)) { logger.fine("Subjob " + subJob.getJobExecution().getExecutionId() + "ended with status '" + batchStatus + "'" );
if (BatchStatus.STOPPING.equals(jobContext.getBatchStatus())) { updateJobBatchStatus(BatchStatus.STOPPED); if (logger.isLoggable(Level.FINE)) { if (jobContext.getBatchStatus().equals(BatchStatus.STOPPING)) { updateJobBatchStatus(BatchStatus.STOPPED); if (logger.isLoggable(Level.FINE)) { if (jobContext.getBatchStatus().equals(BatchStatus.STOPPING)) { updateJobBatchStatus(BatchStatus.STOPPED); if (logger.isLoggable(Level.FINE)) { if (!(curStatus.equals(BatchStatus.FAILED) || curStatus.equals(BatchStatus.STOPPED))) { updateJobBatchStatus(BatchStatus.COMPLETED);
if (jobExecutionImpl.getJobContext().getBatchStatus().equals(BatchStatus.STOPPING)){ this.stepContext.setBatchStatus(BatchStatus.STOPPED); if (batchStatus.equals(BatchStatus.FAILED)) { if (logger.isLoggable(Level.FINE)) { logger.fine("Subjob " + subJob.getJobExecution().getExecutionId() + "ended with status '" + batchStatus + "'" ); } else if (batchStatus.equals(BatchStatus.STOPPED)) { if (logger.isLoggable(Level.FINE)) { logger.fine("Subjob " + subJob.getJobExecution().getExecutionId() + "ended with status '" + batchStatus + "'" ); if (!!!BatchStatus.FAILED.equals(stepContext.getBatchStatus())) { stepContext.setBatchStatus(BatchStatus.STOPPED);
if (stepContext.getBatchStatus().equals(BatchStatus.STOPPING)) { theStatus.setFinished(true);
if (jobExecutionImpl.getJobContext().getBatchStatus().equals(BatchStatus.STOPPING)){ this.statusStopped(); } else {
@Override public void stop() { if (jobContext.getBatchStatus().equals(BatchStatus.STARTING) || jobContext.getBatchStatus().equals(BatchStatus.STARTED)) { updateJobBatchStatus(BatchStatus.STOPPING); if (this.currentStoppableElementController != null) { this.currentStoppableElementController.stop(); } } else { //TODO do we need to throw an error if the batchlet is already stopping/stopped //a stop gets issued twice } }
@Override protected void invokePostStepArtifacts() { // Invoke the reducer after all parallel steps are done if (this.partitionReducerProxy != null) { if ((BatchStatus.COMPLETED).equals(stepContext.getBatchStatus())) { this.partitionReducerProxy.afterPartitionedStepCompletion(PartitionStatus.COMMIT); }else { this.partitionReducerProxy.afterPartitionedStepCompletion(PartitionStatus.ROLLBACK); } } } }
@Override public synchronized void stop() { if (BatchStatus.STARTING.equals(stepContext.getBatchStatus()) || BatchStatus.STARTED.equals(stepContext.getBatchStatus())) { stepContext.setBatchStatus(BatchStatus.STOPPING); if (batchletProxy != null) { batchletProxy.stop(); } } else { //TODO do we need to throw an error if the batchlet is already stopping/stopped //a stop gets issued twice } }