code: public JobExecution completeNewJob(String jobXMLName, Properties jobParameters) throws IllegalStateException {
          long executionId = jobOp.start(jobXMLName, jobParameters);
          JobExecution jobExec = waitForFinish(executionId);
          if (jobExec.getBatchStatus().equals(BatchStatus.COMPLETED)) {
              logger.finer("Job " + executionId + " successfully completed.");
              return jobExec;
          } else {
              throw new IllegalStateException("Job " + executionId + " finished with non-completed state: " + jobExec.getBatchStatus());
          }
      }
docs: Wait for {@code JobWaiter#timeout} seconds for BOTH of:
  
  1) BatchStatus to be one of: STOPPED ,FAILED , COMPLETED, ABANDONED
  AND
  2) exitStatus to be non-null
  
  Returns JobExecution if it ends in <b>COMPLETED</b> status, otherwise throws
  <b>IllegalStateException</b>
  
  @param jobXMLName
  @param jobParameters
  @return JobExecution (for successfully completing job)
  @throws IllegalStateException