docs: public JobExecution completeNewJobWithRestart(String jobXMLName, Properties jobParameters, int restartAttempts) throws IllegalStateException {
          long executionId = jobOp.start(jobXMLName, jobParameters);
          JobExecution jobExec = waitForFinish(executionId);
  
          if (jobExec.getBatchStatus().equals(BatchStatus.FAILED)) {
  
              for (int i = 0; i < restartAttempts; i++) {
                  jobParameters.put("restartCount", Integer.toString(i + 1));
  
                  executionId = jobOp.restart(executionId, jobParameters);
                  jobExec = waitForFinish(executionId);
  
                  if (jobExec.getBatchStatus().equals(BatchStatus.COMPLETED)) {
                      logger.finer("Job " + executionId + " successfully completed.");
                      return jobExec;
                  }
              }
  
              throw new IllegalStateException("Job " + executionId + " failed to complete within the allowed number of restarts (" + restartAttempts + ")."
                                              + " Last execution status is: " + jobExec.getBatchStatus());
  
          } else {
              throw new IllegalStateException("Job " + executionId + " expected to fail and be restartable, but status is: " + jobExec.getBatchStatus());
          }
      }