code: private void transitionToFinalBatchStatus() {
          StopLock stopLock = getStopLock(); // Store in local variable to facilitate Ctrl+Shift+G search in Eclipse
          synchronized (stopLock) {
              BatchStatus currentBatchStatus = runtimeStepExecution.getBatchStatus();
              if (currentBatchStatus.equals(BatchStatus.STARTED)) {
                  updateStepBatchStatus(BatchStatus.COMPLETED);
              } else if (currentBatchStatus.equals(BatchStatus.STOPPING)) {
                  updateStepBatchStatus(BatchStatus.STOPPED);
              } else if (currentBatchStatus.equals(BatchStatus.FAILED)) {
                  updateStepBatchStatus(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");
              }
          }
      }
docs: 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.