docs: private <T> TimerStatus<T> newTask(Object task, TaskInfo taskInfo, Trigger trigger, Object result) {
          if (task == null)
              throw new NullPointerException(taskInfo.isSubmittedAsCallable() ? Callable.class.getName() : Runnable.class.getName());
  
          TaskRecord record = new TaskRecord(true);
          record.unsetId();
  
          TimerTrigger timerTrigger = trigger instanceof TimerTrigger ? (TimerTrigger) trigger : null;
          String owner = timerTrigger == null ? getOwner() : timerTrigger.getAppName();
          if (owner == null)
              throw new RejectedExecutionException(Tr.formatMessage(tc, "CWWKC1540.thread.cannot.submit.tasks"));
          else
              record.setIdentifierOfOwner(owner);
  
          Config config = configRef.get();
          long identifierOfPartition;
          Long alternatePartition = null;
          try {
              // If the current instance isn't able to run tasks, look for one that is
              if (!config.enableTaskExecution) {
                  Controller controller = controllerRef.getService();
                  if (controller != null)
                      alternatePartition = controller.getActivePartitionId();
              }
              identifierOfPartition = alternatePartition == null ? getPartitionId() : alternatePartition;
          } catch (RuntimeException x) {
              throw x;
          } catch (Exception x) {
              throw new RejectedExecutionException(x);
          }
          record.setIdentifierOfPartition(identifierOfPartition);
  
          Map<String, String> execProps = getExecutionProperties(task);
  
          String name = execProps.get(ManagedTask.IDENTITY_NAME);
          record.setName(Utils.normalizeString(name));
  
          String longRunningHint = execProps.get(ManagedTask.LONGRUNNING_HINT);
          if (Boolean.parseBoolean(longRunningHint))
              throw new RejectedExecutionException(ManagedTask.LONGRUNNING_HINT + ": " + longRunningHint);
  
          int txTimeout;
          String txTimeoutString = execProps.get(PersistentExecutor.TRANSACTION_TIMEOUT);
          try {
              txTimeout = txTimeoutString == null ? 0 : Integer.parseInt(txTimeoutString);
              if (txTimeout < 0)
                  throw new IllegalArgumentException(PersistentExecutor.TRANSACTION_TIMEOUT + ": " + txTimeoutString);
          } catch (NumberFormatException x) {
              throw new IllegalArgumentException(PersistentExecutor.TRANSACTION_TIMEOUT + ": " + txTimeoutString, x);
          }
          record.setTransactionTimeout(txTimeout);
  
          short flags = 0;
          String autoPurge = execProps.get(AutoPurge.PROPERTY_NAME);
          if (autoPurge == null || AutoPurge.ON_SUCCESS.toString().equals(autoPurge))
              flags |= TaskRecord.Flags.AUTO_PURGE_ON_SUCCESS.bit;
          else if (AutoPurge.ALWAYS.toString().equals(autoPurge))
              flags |= TaskRecord.Flags.AUTO_PURGE_ALWAYS.bit | TaskRecord.Flags.AUTO_PURGE_ON_SUCCESS.bit;
          if (trigger instanceof TaskLocker)
              flags |= TaskRecord.Flags.EJB_SINGLETON.bit;
          if (trigger instanceof TimerTrigger)
              flags |= TaskRecord.Flags.EJB_TIMER.bit;
          if (taskInfo.getInterval() == -1 && taskInfo.getInitialDelay() != -1)
              flags |= TaskRecord.Flags.ONE_SHOT_TASK.bit;
          if (ManagedTask.SUSPEND.equals(execProps.get(ManagedTask.TRANSACTION)))
              flags |= TaskRecord.Flags.SUSPEND_TRAN_OF_EXECUTOR_THREAD.bit;
  
          record.setMiscBinaryFlags(flags);
  
          Date now = new Date();
          long originalSubmitTime = now.getTime();
          record.setOriginalSubmitTime(originalSubmitTime);
  
          record.setState((short) (TaskState.SCHEDULED.bit | TaskState.UNATTEMPTED.bit));
  
          taskInfo.initThreadContext(contextSvcRef.getServiceWithException(), execProps);
  
          // Avoid serializing task if the same instance is shared with trigger
          if (task != trigger)
              if (task instanceof Serializable)
                  try {
                      record.setTask(serialize(task));
                  } catch (IOException x) {
                      throw new IllegalArgumentException(Utils.toString(task), x);
                  }
              else
                  taskInfo.initForNonSerializableTask(task.getClass().getName());
  
          ClassLoader loader = timerTrigger == null ? InvokerTask.priv.getContextClassLoader() : timerTrigger.getClassLoader();
          record.setIdentifierOfClassLoader(classloaderIdSvc.getClassLoaderIdentifier(loader));
  
          if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
              ComponentMetaData cData = ComponentMetaDataAccessorImpl.getComponentMetaDataAccessor().getComponentMetaData();
              Tr.debug(this, tc, "submitter info", cData == null ? null : cData.getJ2EEName(), loader);
          }
  
          record.setTrigger(null);
          long initialDelay = taskInfo.getInitialDelay();
          if (initialDelay >= 0)
              record.setNextExecutionTime(originalSubmitTime + initialDelay);
          else {
              if (trigger == null)
                  throw new NullPointerException(Trigger.class.getName());
  
              Date nextExecutionDate;
              try {
                  nextExecutionDate = trigger.getNextRunTime(null, now);
              } catch (Throwable x) {
                  throw new RejectedExecutionException(x);
              }
              if (nextExecutionDate == null)
                  throw new RejectedExecutionException("Trigger.getNextRunTime: null");
              record.setNextExecutionTime(nextExecutionDate.getTime());
  
              // Trigger must be serialized after getNextRunTime to properly capture its state
              if (trigger instanceof Serializable)
                  try {
                      record.setTrigger(serialize(trigger));
                  } catch (IOException x) {
                      throw new IllegalArgumentException(Utils.toString(trigger), x);
                  }
              else
                  taskInfo.initForNonSerializableTrigger(trigger.getClass().getName());
          }
  
          try {
              record.setTaskInformation(serialize(taskInfo));
          } catch (IOException x) {
              throw new RejectedExecutionException(x);
          }
  
          if (result != null)
              try {
                  record.setResult(serialize(result));
              } catch (IOException x) {
                  throw new IllegalArgumentException(Utils.toString(result), x);
              }
  
          TransactionController tranController = new TransactionController();
          try {
              tranController.preInvoke();
  
              taskStore.create(record);
  
              // Immediately schedule tasks that should run in the near future or run on other instances if the transaction commits
              long nextExecTime = record.getNextExecutionTime();
              Synchronization autoSchedule = null;
              if (config.enableTaskExecution && (config.pollInterval < 0 || nextExecTime <= new Date().getTime() + config.pollInterval))
                  autoSchedule = new InvokerTask(this, record.getId(), nextExecTime, record.getMiscBinaryFlags(), txTimeout);
              else if (alternatePartition != null) {
                  Controller controller = controllerRef.getService();
                  if (controller != null)
                      autoSchedule = new ControllerAutoSchedule(controller, alternatePartition, record.getId(), nextExecTime, record.getMiscBinaryFlags(), record
                                      .getTransactionTimeout());
              }
              if (autoSchedule != null) {
                  UOWCurrent uowCurrent = (UOWCurrent) tranController.tranMgr;
                  tranController.tranMgr.registerSynchronization(uowCurrent.getUOWCoord(), autoSchedule, EmbeddableWebSphereTransactionManager.SYNC_TIER_OUTER);
              }
          } catch (Throwable x) {
              tranController.setFailure(x);
          } finally {
              RejectedExecutionException x = tranController.postInvoke(RejectedExecutionException.class);
              if (x != null)
                  throw x;
          }
  
          return new TaskStatusImpl<T>(record, this);
      }