docs: @FFDCIgnore(Throwable.class)
      @Override
      public T call() throws Exception {
          final boolean trace = TraceComponent.isAnyTracingEnabled();
  
          if (future.isCancelled()) {
              if (trace && tc.isDebugEnabled())
                  Tr.debug(this, tc, "canceled - not running the task");
              return null;
          }
  
          Result result = resultRef.get(), resultForThisExecution = result;
          Status<T> skipped = null;
          Status<T> status;
          boolean done = false;
          T taskResult = null;
          ArrayList<ThreadContext> contextAppliedToThread = null;
          resultForThisExecution.executionThread = Thread.currentThread();
          try {
              // EE Concurrency 3.2.6.1: All tasks submitted to an executor must not run if task's component is not started.
              // ThreadContextDescriptor.taskStarting covers this requirement for us.
              contextAppliedToThread = threadContextDescriptor.taskStarting();
  
              // Determine if task should be skipped
              if (trigger != null)
                  try {
                      if (trigger.skipRun(lastExecution, new Date(nextExecutionTime)))
                          skipped = new Status<T>(Status.Type.SKIPPED, null, null, false);
                  } catch (Throwable x) {
                      // spec requires skip when skipRun fails
                      Tr.error(tc, "CWWKC1103.skip.run.failed", getName(), managedExecSvc.name, x);
                      skipped = new Status<T>(Status.Type.SKIPPED, null, x, false);
                  }
  
              Date nextExecutionDate = null;
  
              // Run task if it wasn't skipped
              if (skipped == null) {
                  // notify listener: taskStarting
                  if (listener != null)
                      try {
                          if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
                              Tr.event(this, tc, "taskStarting", managedExecSvc, task);
                          listener.taskStarting(future, managedExecSvc, task);
                      } finally {
                          done = result.getStatus().type == Status.Type.CANCELED;
                      }
  
                  // run the task if the listener didn't cancel it
                  status = result.getStatus();
                  if (status.type == Status.Type.SUBMITTED && result.compareAndSet(status, new Status<T>(Status.Type.STARTED, null, null, false))) {
                      try {
                          if (trigger == null)
                              if (isCallable)
                                  taskResult = ((Callable<T>) task).call();
                              else
                                  ((Runnable) task).run();
                          else {
                              long startTime = System.currentTimeMillis();
  
                              if (isCallable)
                                  taskResult = ((Callable<T>) task).call();
                              else
                                  ((Runnable) task).run();
  
                              long endTime = System.currentTimeMillis();
                              String identityName = threadContextDescriptor.getExecutionProperties().get(ManagedTask.IDENTITY_NAME);
                              lastExecution = new LastExecutionImpl(identityName, nextExecutionTime, startTime, endTime, taskResult);
                          }
                      } catch (Throwable x) {
                          Tr.error(tc, "CWWKC1101.task.failed", getName(), managedExecSvc.name, x);
                          status = result.getStatus();
                          if (status.type == Status.Type.CANCELED) // include the failure in the result so it will be available to taskDone
                              result.compareAndSet(status, new Status<T>(Status.Type.CANCELED, null, x, true));
                          else if (status.type == Status.Type.STARTED)
                              result.compareAndSet(status, new Status<T>(Status.Type.DONE, null, x, true));
                          result.latch.countDown();
                      }
  
                      status = result.getStatus();
                      if (status.type == Status.Type.STARTED) {
                          // calculate next execution
                          if (trigger == null)
                              result.compareAndSet(status, new Status<T>(Status.Type.DONE, taskResult, null, fixedDelay == null && fixedRate == null));
                          else {
                              nextExecutionDate = trigger.getNextRunTime(lastExecution, taskScheduledTime);
                              if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                                  Tr.debug(this, tc, "getNextRunTime", trigger, lastExecution,
                                           "taskScheduled " + Utils.toString(taskScheduledTime),
                                           "nextRunTime = " + Utils.toString(nextExecutionDate));
  
                              result.compareAndSet(status, new Status<T>(Status.Type.DONE, taskResult, null, nextExecutionDate == null));
                          }
  
                          result.latch.countDown();
                      }
  
                      done = true;
  
                      if (listener != null)
                          try {
                              if (status.type == Status.Type.CANCELED)
                                  try {
                                      CancellationException cancelX = new CancellationException(Tr.formatMessage(tc, "CWWKC1110.task.canceled", getName(), managedExecSvc.name));
                                      if (trace && tc.isEventEnabled())
                                          Tr.event(this, tc, "taskCanceled", managedExecSvc, task, cancelX);
                                      listener.taskAborted(future, managedExecSvc, task, cancelX);
                                  } catch (Throwable x) {
                                      Tr.error(tc, "CWWKC1102.listener.failed", getName(), managedExecSvc.name, x);
                                  }
  
                              Throwable failure = result.getStatus().failure;
                              if (trace && tc.isEventEnabled())
                                  Tr.event(this, tc, "taskDone", managedExecSvc, task, failure);
                              listener.taskDone(future, managedExecSvc, task, failure);
                          } catch (Throwable x) {
                              Tr.error(tc, "CWWKC1102.listener.failed", getName(), managedExecSvc.name, x);
                          }
                  }
              } else {
                  // Skip this execution (only possible if using a trigger)
                  try {
                      status = result.getStatus();
                      if (status.type == Status.Type.SUBMITTED)
                          result.compareAndSet(status, skipped);
  
                      // calculate next execution
                      nextExecutionDate = trigger.getNextRunTime(lastExecution, taskScheduledTime);
                      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                          Tr.debug(this, tc, "getNextRunTime", trigger, lastExecution,
                                   "taskScheduled " + Utils.toString(taskScheduledTime),
                                   "nextRunTime = " + Utils.toString(nextExecutionDate));
  
                      // No next execution
                      if (nextExecutionDate == null)
                          result.compareAndSet(skipped, new Status<T>(Status.Type.SKIPPED, null, skipped.failure, true));
                  } finally {
                      result.latch.countDown();
  
                      // notify listener: taskAborted
                      if (listener != null) {
                          if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
                              Tr.event(this, tc, "taskAborted(skipped)", managedExecSvc, task);
                          listener.taskAborted(future, managedExecSvc, task, new SkippedException(skipped.failure));
                      }
                  }
  
                  // notify listener: taskDone
                  if (listener != null) {
                      if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
                          Tr.event(this, tc, "taskDone(skipped)", managedExecSvc, task);
                      listener.taskDone(future, managedExecSvc, task, null);
                  }
              }
  
              // Resubmit this task to run at the next scheduled time
              status = result.getStatus();
              if (!status.finalExecutionIsComplete && (status.type == Status.Type.DONE || status.type == Status.Type.SKIPPED)) {
                  if (trace && tc.isEventEnabled())
                      Tr.event(this, tc, "DONE-->NONE (reset for next result)");
                  resultRef.set(result = new Result());
                  done = false;
  
                  // compute the delay and estimate the next execution time
                  long delay;
                  if (fixedDelay != null) {
                      delay = fixedDelay;
                      nextExecutionTime = System.nanoTime() + unit.toNanos(delay);
                  } else if (fixedRate != null) {
                      // Time elapsed from when the task should have started for the first time
                      long nanoTime = System.nanoTime();
                      long elapsed = unit.convert(nanoTime - taskScheduledNanos, TimeUnit.NANOSECONDS) - initialDelay;
                      delay = ((elapsed / fixedRate) + 1) * fixedRate - elapsed;
                      nextExecutionTime = nanoTime + unit.toNanos(delay);
                  } else {
                      nextExecutionTime = nextExecutionDate.getTime();
                      delay = nextExecutionTime - System.currentTimeMillis();
                  }
  
                  if (delay < 0)
                      delay = 0;
  
                  // notify listener: taskSubmitted
                  if (listener != null)
                      try {
                          result.executionThread = Thread.currentThread();
                          if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
                              Tr.event(this, tc, "taskSubmitted", managedExecSvc, task);
                          listener.taskSubmitted(future, managedExecSvc, task);
                      } finally {
                          result.executionThread = null;
                      }
  
                  // reschedule the task if the listener didn't cancel it
                  status = result.getStatus();
                  if (status.type == Status.Type.NONE && result.compareAndSet(status, new Status<T>(Status.Type.SUBMITTED, null, null, false))) {
                      if (trace && tc.isDebugEnabled())
                          Tr.debug(this, tc, "reschedule " + delay + ' ' + unit + " from now");
                      ScheduledFuture<?> scheduledFuture = managedExecSvc.scheduledExecSvc.schedule(this, delay, unit);
                      future.scheduledFutureRef.set(scheduledFuture);
                  }
              }
          } catch (Throwable x) {
              // Some cases where this can happen:
              // component that scheduled the task is no longer available
              // listener.taskAborted (for skipped task) fails
              // trigger.getNextRunTime (for reschedule after skip) fails
              // listener.taskStarting fails
              // trigger.getNextRunTime (for reschedule after success) fails
              // taskAborted or taskDone fails
              // Liberty scheduled executor unavailable, or it fails to schedule
  
              if (contextAppliedToThread == null && x instanceof IllegalStateException && FrameworkState.isStopping()) {
                  if (trace && tc.isDebugEnabled())
                      Tr.debug(this, tc, "Task not started due to server shutdown", getName(), x);
              } else
                  Tr.error(tc, "CWWKC1101.task.failed", getName(), managedExecSvc.name, x);
  
              status = result.getStatus();
              if (!status.finalExecutionIsComplete) {
                  Status<T> newStatus = status.type == Status.Type.STARTED ? new Status<T>(Status.Type.DONE, null, x, true) : new Status<T>(Status.Type.ABORTED, null, x, true);
                  result.compareAndSet(status, newStatus);
              }
              result.latch.countDown();
  
              if (listener != null && !done)
                  try {
                      try {
                          if (skipped == null && status.type != Status.Type.STARTED) {
                              if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
                                  Tr.event(this, tc, "taskAborted", managedExecSvc);
                              listener.taskAborted(future, managedExecSvc, task, new AbortedException(x));
                          }
                      } finally {
                          if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
                              Tr.event(this, tc, "taskDone", managedExecSvc, task, x);
                          listener.taskDone(future, managedExecSvc, task, x);
                      }
                  } catch (Throwable t) {
                      // Log message, but otherwise ignore because we want to the original failure to be raised
                      Tr.error(tc, "CWWKC1102.listener.failed", getName(), managedExecSvc.name, x);
                  }
  
              if (x instanceof Exception)
                  throw (Exception) x;
              else
                  throw (Error) x;
          } finally {
              resultForThisExecution.executionThread = null;
              if (contextAppliedToThread != null)
                  threadContextDescriptor.taskStopping(contextAppliedToThread);
          }
  
          return taskResult;
      }