@Override public BatchStatus getBatchStatus() { if (stepContext != null) { return this.stepContext.getBatchStatus(); } else { return batchStatus; } }
@Override public BatchStatus getBatchStatus() { if (stepContext != null){ return this.stepContext.getBatchStatus(); } else { return batchStatus; } }
@Override public synchronized void stop() { // It is possible for stop() to be issued before process() 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 } }
@Override public synchronized void stop() { // It is possible for stop() to be issued before process() 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 } }
private void defaultExitStatusIfNecessary() { String stepExitStatus = stepContext.getExitStatus(); String processRetVal = stepContext.getBatchletProcessRetVal(); if (stepExitStatus != null) { logger.fine("Returning with user-set exit status: " + stepExitStatus); } else if (processRetVal != null) { logger.fine("Returning with exit status from batchlet.process(): " + processRetVal); stepContext.setExitStatus(processRetVal); } else { logger.fine("Returning with default exit status"); stepContext.setExitStatus(stepContext.getBatchStatus().name()); } }
private void defaultExitStatusIfNecessary() { String stepExitStatus = stepContext.getExitStatus(); String processRetVal = stepContext.getBatchletProcessRetVal(); if (stepExitStatus != null) { logger.fine("Returning with user-set exit status: " + stepExitStatus); } else if (processRetVal != null) { logger.fine("Returning with exit status from batchlet.process(): " + processRetVal); stepContext.setExitStatus(processRetVal); } else { logger.fine("Returning with default exit status"); stepContext.setExitStatus(stepContext.getBatchStatus().name()); } }
String batchStatus = stepContext.getBatchStatus() == null ? BatchStatus.STARTING.name() : stepContext.getBatchStatus().name(); String exitStatus = stepContext.getExitStatus(); String stepName = stepContext.getStepName();
@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); } } // Called in spec'd order, e.g. Sec. 11.7 if (stepListeners != null) { for (StepListenerProxy listenerProxy : stepListeners) { // Call afterStep on all the step listeners listenerProxy.afterStep(); } } }
@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); } } // Called in spec'd order, e.g. Sec. 11.7 if (stepListeners != null) { for (StepListenerProxy listenerProxy : stepListeners) { // Call afterStep on all the step listeners listenerProxy.afterStep(); } } }
/** * The only valid states at this point are STARTED,STOPPING, or FAILED. * been able to get to STOPPED, or COMPLETED yet at this point in the code. */ private void transitionToFinalBatchStatus() { BatchStatus currentBatchStatus = stepContext.getBatchStatus(); if (currentBatchStatus.equals(BatchStatus.STARTED)) { updateBatchStatus(BatchStatus.COMPLETED); } else if (currentBatchStatus.equals(BatchStatus.STOPPING)) { updateBatchStatus(BatchStatus.STOPPED); } else if (currentBatchStatus.equals(BatchStatus.FAILED)) { updateBatchStatus(BatchStatus.FAILED); // Should have already been done but maybe better for possible code refactoring to have it here. } else { throw new IllegalStateException("Step batch status should not be in a " + currentBatchStatus.name() + " state"); } }
/** * The only valid states at this point are STARTED,STOPPING, or FAILED. * been able to get to STOPPED, or COMPLETED yet at this point in the code. */ private void transitionToFinalBatchStatus() { BatchStatus currentBatchStatus = stepContext.getBatchStatus(); if (currentBatchStatus.equals(BatchStatus.STARTED)) { updateBatchStatus(BatchStatus.COMPLETED); } else if (currentBatchStatus.equals(BatchStatus.STOPPING)) { updateBatchStatus(BatchStatus.STOPPED); } else if (currentBatchStatus.equals(BatchStatus.FAILED)) { updateBatchStatus(BatchStatus.FAILED); // Should have already been done but maybe better for possible code refactoring to have it here. } else { throw new IllegalStateException("Step batch status should not be in a " + currentBatchStatus.name() + " state"); } }
if (stepContext.getBatchStatus().equals(BatchStatus.STOPPING)) { currentChunkStatus.markStopping(); break;
@Override public StepExecutionImpl createStepExecution(long rootJobExecId, StepContextImpl stepContext) { StepExecutionImpl stepExecution = null; String batchStatus = stepContext.getBatchStatus() == null ? BatchStatus.STARTING.name() : stepContext.getBatchStatus().name(); String exitStatus = stepContext.getExitStatus(); String stepName = stepContext.getStepName();
if (stepContext.getBatchStatus().equals(BatchStatus.STOPPING)) { theStatus.setFinished(true);
@Override public StepExecutionImpl createStepExecution(long rootJobExecId, StepContextImpl stepContext) { StepExecutionImpl stepExecution = null; String batchStatus = stepContext.getBatchStatus() == null ? BatchStatus.STARTING.name() : stepContext.getBatchStatus().name(); String exitStatus = stepContext.getExitStatus(); String stepName = stepContext.getStepName();
@Override public void updateStepExecution(long rootJobExecId, StepContextImpl stepContext) { long stepExecutionId = stepContext.getStepExecutionId(); String batchStatus = stepContext.getBatchStatus() == null ? BatchStatus.STARTING.name() : stepContext.getBatchStatus().name(); String exitStatus = stepContext.getExitStatus(); String stepName = stepContext.getStepName();