docs: public StepThreadExecutionEntity updateStepExecutionOnRecovery(PersistenceServiceUnit psu,
                                                                     final long stepExecutionId,
                                                                     final BatchStatus newStepBatchStatus,
                                                                     final String newStepExitStatus,
                                                                     final Date endTime) throws IllegalArgumentException {
  
          EntityManager em = psu.createEntityManager();
          try {
              return new TranRequest<StepThreadExecutionEntity>(em) {
                  @Override
                  public StepThreadExecutionEntity call() {
  
                      StepThreadExecutionEntity stepExec = entityMgr.find(StepThreadExecutionEntity.class, stepExecutionId);
                      if (stepExec == null) {
                          throw new IllegalArgumentException("StepThreadExecEntity with id =" + stepExecutionId + " should be persisted at this point, but didn't find it.");
                      }
  
                      try {
                          verifyThreadStatusTransitionIsValid(stepExec, newStepBatchStatus);
                      } catch (BatchIllegalJobStatusTransitionException e) {
                          throw new PersistenceException(e);
                      }
  
                      stepExec.setBatchStatus(newStepBatchStatus);
                      stepExec.setExitStatus(newStepExitStatus);
                      stepExec.setEndTime(endTime);
                      return stepExec;
                  }
              }.runInNewOrExistingGlobalTran();
          } finally {
              em.close();
          }
      }