docs: protected boolean deliverOutcome(JTAResource currResource) {
          if (tc.isEntryEnabled())
              Tr.entry(tc, "deliverOutcome", currResource);
  
          boolean retryRequired = false; // indicates whether retry necessary
          boolean informResource = true;
          int flowType = -1;
          boolean preparedResource = true;
          boolean auditing = false;
  
          try {
              switch (currResource.getResourceStatus()) {
                  case StatefulResource.PREPARED:
                      currResource.setResourceStatus(StatefulResource.COMPLETING);
                      // NB. no break
                  case StatefulResource.COMPLETING: // retry case
                      auditing = _transaction.auditSendCompletion(currResource, _outcome);
                      if (_outcome) {
                          if (xaFlowCallbackEnabled) {
                              informResource = XAFlowCallbackControl.beforeXAFlow(XAFlowCallback.COMMIT, XAFlowCallback.COMMIT_2PC);
                              flowType = XAFlowCallback.COMMIT;
                          }
  
                          if (informResource) {
                              currResource.commit();
                          }
  
                          currResource.setResourceStatus(StatefulResource.COMMITTED);
                      } else {
                          if (xaFlowCallbackEnabled) {
                              informResource = XAFlowCallbackControl.beforeXAFlow(XAFlowCallback.ROLLBACK, XAFlowCallback.ROLLBACK_NORMAL);
                              flowType = XAFlowCallback.ROLLBACK;
                          }
  
                          if (informResource) {
                              currResource.rollback();
                          }
  
                          currResource.setResourceStatus(StatefulResource.ROLLEDBACK);
                      }
                      if (auditing)
                          _transaction.auditCompletionResponse(XAResource.XA_OK, currResource, _outcome);
  
                      break;
  
                  case StatefulResource.COMPLETING_ONE_PHASE: // retry remote Corba resource only
                      preparedResource = false;
                      if (_outcome) {
                          if (xaFlowCallbackEnabled) {
                              informResource = XAFlowCallbackControl.beforeXAFlow(XAFlowCallback.COMMIT, XAFlowCallback.COMMIT_1PC_OPT);
                              flowType = XAFlowCallback.COMMIT;
                          }
  
                          if (informResource) {
                              currResource.commit_one_phase();
                          }
  
                          currResource.setResourceStatus(StatefulResource.COMMITTED); // d396035
                      } else {
                          if (xaFlowCallbackEnabled) {
                              informResource = XAFlowCallbackControl.beforeXAFlow(XAFlowCallback.ROLLBACK, XAFlowCallback.ROLLBACK_NORMAL);
                              flowType = XAFlowCallback.ROLLBACK;
                          }
  
                          if (informResource) {
                              currResource.rollback();
                          }
  
                          currResource.setResourceStatus(StatefulResource.ROLLEDBACK);
                      }
  
                      break;
  
                  case StatefulResource.REGISTERED:
                      preparedResource = false;
                      if (!_outcome) // else error?
                      {
                          currResource.setResourceStatus(StatefulResource.COMPLETING);
  
                          if (xaFlowCallbackEnabled) {
                              informResource = XAFlowCallbackControl.beforeXAFlow(XAFlowCallback.ROLLBACK, XAFlowCallback.ROLLBACK_NORMAL);
                              flowType = XAFlowCallback.ROLLBACK;
                          }
  
                          if (informResource) {
                              currResource.rollback();
                          }
  
                          currResource.setResourceStatus(StatefulResource.ROLLEDBACK);
                      }
  
                      break;
  
                  default: // do nothing
                      break;
  
              } // end switch
  
              if (flowType != -1) {
                  if (xaFlowCallbackEnabled) {
                      XAFlowCallbackControl.afterXAFlow(flowType, XAFlowCallback.AFTER_SUCCESS);
                  }
              }
          } catch (XAException xae) {
              _errorCode = xae.errorCode; // Save locally for FFDC
              FFDCFilter.processException(xae, "com.ibm.tx.jta.impl.RegisteredResources.deliverOutcome", "1923", this);
              if (tc.isDebugEnabled())
                  Tr.debug(tc, "XAException: error code " + XAReturnCodeHelper.convertXACode(_errorCode), xae);
              if (auditing)
                  _transaction.auditCompletionResponse(_errorCode, currResource, _outcome);
  
              if (xaFlowCallbackEnabled) {
                  XAFlowCallbackControl.afterXAFlow(flowType, XAFlowCallback.AFTER_FAIL);
              }
  
              if (_errorCode == XAException.XA_HEURRB) {
                  // Record that this resource has completed with heuristics
                  currResource.setResourceStatus(StatefulResource.HEURISTIC_ROLLBACK);
  
                  // report if appropriate
                  if (_outcome && !auditing) {
                      _diagnosticsRequired = true;
                      Tr.error(tc, "WTRN0075_HEURISTIC_ON_COMMIT", _transaction.getTranName());
                  }
  
              } else if (_errorCode == XAException.XA_HEURCOM) {
                  // Record that this resource has completed with heuristics
                  currResource.setResourceStatus(StatefulResource.HEURISTIC_COMMIT);
  
                  // report if appropriate
                  if (!_outcome && !auditing) {
                      _diagnosticsRequired = true;
                      Tr.error(tc, "WTRN0076_HEURISTIC_ON_ROLLBACK", _transaction.getTranName());
                  }
  
              } else if (_errorCode == XAException.XA_HEURMIX) {
                  // Record that this resource has completed with heuristics
                  currResource.setResourceStatus(StatefulResource.HEURISTIC_MIXED);
  
                  // report if appropriate
                  if (!auditing) {
                      _diagnosticsRequired = true;
                      if (_outcome) {
                          Tr.error(tc, "WTRN0075_HEURISTIC_ON_COMMIT", _transaction.getTranName());
                      } else {
                          Tr.error(tc, "WTRN0076_HEURISTIC_ON_ROLLBACK", _transaction.getTranName());
                      }
                  }
  
              } else if (_errorCode == XAException.XA_HEURHAZ) {
                  // Record that this resource has completed with heuristics
                  currResource.setResourceStatus(StatefulResource.HEURISTIC_HAZARD);
  
                  // report if appropriate
                  if (!auditing) {
                      _diagnosticsRequired = true;
                      if (_outcome) {
                          Tr.error(tc, "WTRN0075_HEURISTIC_ON_COMMIT", _transaction.getTranName());
                      } else {
                          Tr.error(tc, "WTRN0076_HEURISTIC_ON_ROLLBACK", _transaction.getTranName());
                      }
                  }
              } else if (_errorCode == XAException.XAER_RMERR) {
                  //
                  // According to XA, XAER_RMERR occured in committing the
                  // work performed on behalf of the transaction branch and
                  // the branch's work has been rolled back. Note that this
                  // error signals a catatrophic event to the TM since other
                  // resource managers may successfully commit their work.
                  // This error should be returned only when a resource manager
                  // concludes that it can never commit the branch and that it
                  // can NOT hold the branch's resources in a prepared state.
                  // system administrator's manual intervention is necessary.
                  //
                  updateHeuristicOutcome(StatefulResource.HEURISTIC_ROLLBACK);
                  currResource.setResourceStatus(StatefulResource.ROLLEDBACK);
                  currResource.destroy();
  
                  if (_outcome && !auditing) {
                      _diagnosticsRequired = true;
                      Tr.error(tc, "WTRN0047_XAER_RMERR_ON_COMMIT", currResource);
                  }
              } else if (_errorCode == XAException.XAER_RMFAIL) {
                  // If we are rolling back and have not prepared, then no need to retry, we are done
                  if (!_outcome && !preparedResource) {
                      currResource.setResourceStatus(StatefulResource.ROLLEDBACK);
                      currResource.destroy();
                  } else // we're prepared and/or its a Corba/WSCoord resource
                  {
                      if (!auditing)
                          logRmfailOnCompleting(currResource, xae);
  
                      // Set the resource's state to failed so that
                      // we will attempt to reconnect to the resource
                      // manager upon retrying.
                      currResource.setState(JTAResource.FAILED);
                      updateHeuristicOutcome(StatefulResource.HEURISTIC_HAZARD);
  
                      // Retry the commit/rollback flow
                      addToFailedResources(currResource);
                      retryRequired = true;
                  }
              } else if (_errorCode == XAException.XA_RETRY) {
                  // Either we are retrying during recovery when trying to access the RM, or
                  // the resource manager has ran out of steam and we need to try again later.
                  // We do not need to set the resource to failed as it is still useable.
                  // This latter error only occurs on a 2PC commit.  Retry the flow
  
                  // We will set the resouce to failed so that after_completion
                  // can be driven and retry will get a new connection
                  // ************************************************************************
                  // NOTE XA SPEC defines this on xa_commit only.  However, RRA will send  // @D6506080A
                  // XA_RETRY on commit and rollback as part of Oracle RAC recovery retries.
                  // The support for this in RRA also requires us to ensure that we set the
                  // resource to failed and drive reconnectRM to get a new XAResource on retry.
                  // ************************************************************************
                  currResource.setState(JTAResource.FAILED);
                  updateHeuristicOutcome(StatefulResource.HEURISTIC_HAZARD);
                  addToFailedResources(currResource);
                  retryRequired = true;
              } else if (_errorCode == XAException.XAER_NOTA) {
                  if (currResource.getResourceStatus() == StatefulResource.COMPLETING_ONE_PHASE) {
                      // NOTA returned from a single Corba resource retrying commit_one_phase
                      // We have no idea what the outcome was. The remote resource may have received
                      // the c1p and committed or rolledback or the remote server may have died and
                      // rolled back the transaction.  Need to return heuristic.
                      // Note: local resources are not retried for commit_one_phase.)
                      updateHeuristicOutcome(StatefulResource.HEURISTIC_HAZARD);
                      // We do not need to forget as the remote resource has already gone away
                      // so just clean up and return...
                  } else if (_outcome && !_retryCompletion) {
                      // NOTA returned on an initial commit after a prepare.
                      // We should never get this unless someone has heuristically forgotten the
                      // branch.  Return hazard as we dont know if it committed or rolled back.
                      updateHeuristicOutcome(StatefulResource.HEURISTIC_HAZARD);
                  }
                  // The resource manager had no knowledge of this transaction.
                  // Perform some cleanup and return normally.
                  currResource.setResourceStatus(StatefulResource.COMPLETED);
                  currResource.destroy();
              } else if (_errorCode >= XAException.XA_RBBASE && _errorCode <= XAException.XA_RBEND) {
                  // These can be returned on a rollback - all is ok
                  currResource.setResourceStatus(StatefulResource.ROLLEDBACK);
                  currResource.destroy();
              } else // XAER_PROTO, XAER_INVAL
              {
                  currResource.setResourceStatus(StatefulResource.COMPLETED);
                  currResource.destroy();
  
                  if (!auditing) {
                      _diagnosticsRequired = true;
                      if (_outcome) {
                          Tr.error(tc, "WTRN0050_UNEXPECTED_XA_ERROR_ON_COMMIT", XAReturnCodeHelper.convertXACode(_errorCode));
                      } else {
                          Tr.error(tc, "WTRN0051_UNEXPECTED_XA_ERROR_ON_ROLLBACK", XAReturnCodeHelper.convertXACode(_errorCode));
                      }
                  }
  
                  // An internal logic error has occured.
                  _systemException = xae;
              }
          } catch (Throwable t) {
              // Treat like RMERR
              FFDCFilter.processException(t, "com.ibm.tx.jta.impl.RegisteredResources.deliverOutcome", "2111", this);
              if (tc.isDebugEnabled())
                  Tr.debug(tc, "RuntimeException", t);
  
              if (xaFlowCallbackEnabled) {
                  XAFlowCallbackControl.afterXAFlow(flowType, XAFlowCallback.AFTER_FAIL);
              }
  
              updateHeuristicOutcome(StatefulResource.HEURISTIC_ROLLBACK);
              currResource.setResourceStatus(StatefulResource.COMPLETED);
              currResource.destroy();
  
              if (_outcome) {
                  if (!auditing)
                      _diagnosticsRequired = true;
                  Tr.error(tc, "WTRN0068_COMMIT_FAILED", t);
              } else if (auditing) {
                  Tr.error(tc, "WTRN0071_ROLLBACK_FAILED", t);
              }
          }
  
          if (tc.isEntryEnabled())
              Tr.exit(tc, "deliverOutcome", retryRequired);
          return retryRequired;
      }