docs: protected void flowCommitOnePhase(boolean lastParticipant)
                      throws RollbackException, SystemException, HeuristicMixedException,
                      HeuristicHazardException, HeuristicRollbackException {
          if (tc.isEntryEnabled())
              Tr.entry(tc, "flowCommitOnePhase", lastParticipant);
  
          final JTAResource resource = _resourceObjects.get(0);
          boolean informResource = true;
          boolean retryNeeded = false;
          Throwable _xaeCaught = null;
          try {
              resource.setResourceStatus(StatefulResource.COMPLETING_ONE_PHASE);
  
              if (xaFlowCallbackEnabled) {
                  informResource = XAFlowCallbackControl.beforeXAFlow(XAFlowCallback.PREPARE,
                                                                      XAFlowCallback.PREPARE_1PC_OPT);
              }
  
              if (informResource) {
                  resource.commit_one_phase();
              }
  
              resource.setResourceStatus(StatefulResource.COMMITTED);
  
              if (xaFlowCallbackEnabled) {
                  XAFlowCallbackControl.afterXAFlow(XAFlowCallback.PREPARE,
                                                    XAFlowCallback.AFTER_SUCCESS);
              }
          } catch (XAException xae) {
              _xaeCaught = xae;
              _errorCode = xae.errorCode; // Save locally for FFDC
              FFDCFilter.processException(xae, "com.ibm.tx.jta.impl.RegisteredResources.flowCommitOnePhase", "3031", this);
              if (tc.isDebugEnabled())
                  Tr.debug(tc, "XAException: error code " + XAReturnCodeHelper.convertXACode(_errorCode), xae);
  
              final Throwable toThrow;
  
              if (xaFlowCallbackEnabled) {
                  XAFlowCallbackControl.afterXAFlow(XAFlowCallback.PREPARE,
                                                    XAFlowCallback.AFTER_FAIL);
              }
  
              if (_errorCode >= XAException.XA_RBBASE &&
                  _errorCode <= XAException.XA_RBEND) {
                  resource.setResourceStatus(StatefulResource.ROLLEDBACK);
                  resource.destroy();
  
                  toThrow = new RollbackException().initCause(xae);
                  if (tc.isEntryEnabled())
                      Tr.exit(tc, "flowCommitOnePhase", toThrow);
                  throw (RollbackException) toThrow;
              } else if (_errorCode == XAException.XA_HEURCOM) {
                  resource.setResourceStatus(StatefulResource.HEURISTIC_COMMIT);
                  updateHeuristicOutcome(StatefulResource.HEURISTIC_COMMIT);
              } else if (_errorCode == XAException.XA_HEURRB) {
                  resource.setResourceStatus(StatefulResource.HEURISTIC_ROLLBACK);
                  Tr.error(tc, "WTRN0075_HEURISTIC_ON_COMMIT", _transaction.getTranName());
                  updateHeuristicOutcome(StatefulResource.HEURISTIC_ROLLBACK);
              } else if (_errorCode == XAException.XA_HEURMIX) {
                  resource.setResourceStatus(StatefulResource.HEURISTIC_MIXED);
                  Tr.error(tc, "WTRN0075_HEURISTIC_ON_COMMIT", _transaction.getTranName());
                  updateHeuristicOutcome(StatefulResource.HEURISTIC_MIXED);
              } else if (_errorCode == XAException.XA_HEURHAZ) {
                  resource.setResourceStatus(StatefulResource.HEURISTIC_HAZARD);
                  Tr.error(tc, "WTRN0075_HEURISTIC_ON_COMMIT", _transaction.getTranName());
                  updateHeuristicOutcome(StatefulResource.HEURISTIC_HAZARD);
              } 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.
                  //
                  Tr.error(tc, "WTRN0047_XAER_RMERR_ON_COMMIT", resource);
                  resource.setResourceStatus(StatefulResource.ROLLEDBACK);
                  resource.destroy();
  
                  toThrow = new RollbackException().initCause(xae);
                  if (tc.isEntryEnabled())
                      Tr.exit(tc, "flowCommitOnePhase", toThrow);
                  throw (RollbackException) toThrow;
              } else if (_errorCode == XAException.XAER_RMFAIL) {
                  if (resourceNeedsRetrying(resource)) {
                      // Kick-off retry thread and return normally.
                      retryNeeded = true;
  
                      // Set the resource's state to failed so that
                      // we will attempt to reconnect to the resource
                      // manager upon retrying.
                      // resource.setState(JTAResource.FAILED); // This is a no-op for Corba resources
                  } else // Local resource - no retry to commit_one_phase
                  {
                      Tr.warning(tc, "WTRN0052_XAER_RMFAIL_ON_COMMIT_ONE_PHASE", resource);
                      resource.setResourceStatus(StatefulResource.COMPLETED);
                      resource.destroy();
                  }
  
                  // Return a heuristic outcome as we have no idea what happenned to the resource
                  updateHeuristicOutcome(StatefulResource.HEURISTIC_HAZARD);
              } else if (_errorCode == XAException.XAER_NOTA) {
                  // The resource manager had no knowledge
                  // of this transaction.
                  // For local XA resource and first time through on a remote resource, if we
                  // get NOTA, we can make the assumption that the d/b rolled back the branch or
                  // the remote server died discarding the branch.
                  resource.setResourceStatus(StatefulResource.COMPLETED);
                  resource.destroy();
                  toThrow = new RollbackException().initCause(xae);
                  if (tc.isEntryEnabled())
                      Tr.exit(tc, "flowCommitOnePhase", toThrow);
                  throw (RollbackException) toThrow;
              } else // XAER_INVAL, XAER_PROTO
              {
                  Tr.error(tc, "WTRN0053_UNEXPECTED_XA_ERROR_ON_COMMIT_ONE_PHASE", XAReturnCodeHelper.convertXACode(_errorCode));
  
                  resource.setResourceStatus(StatefulResource.COMPLETED);
                  resource.destroy();
  
                  // An internal logic error has occured
                  toThrow = new SystemException().initCause(xae);
                  if (tc.isEntryEnabled())
                      Tr.exit(tc, "flowCommitOnePhase", toThrow);
                  throw (SystemException) toThrow;
              }
          } catch (Throwable t) {
              // Treat like RMERR
              FFDCFilter.processException(t, "com.ibm.tx.jta.impl.RegisteredResources.flowCommitOnePhase", "3172", this);
              if (tc.isDebugEnabled())
                  Tr.debug(tc, "RuntimeException", t);
  
              final Throwable toThrow;
  
              if (xaFlowCallbackEnabled) {
                  XAFlowCallbackControl.afterXAFlow(XAFlowCallback.PREPARE,
                                                    XAFlowCallback.AFTER_FAIL);
              }
  
              Tr.error(tc, "WTRN0070_ONE_PHASE_COMMIT_FAILED", t);
              resource.setResourceStatus(StatefulResource.COMPLETED);
              resource.destroy();
  
              toThrow = new RollbackException().initCause(t);
              if (tc.isEntryEnabled())
                  Tr.exit(tc, "flowCommitOnePhase", toThrow);
              throw (RollbackException) toThrow;
          }
  
          if (_systemException != null) {
              final Throwable toThrow = new SystemException().initCause(_systemException);
              if (tc.isEntryEnabled())
                  Tr.exit(tc, "flowCommitOnePhase", toThrow);
              throw (SystemException) toThrow;
          }
  
          // the following assumes that this is NOT a subordinate
          // If LPS, we do not need to retry as we will effectively return a "vote" and then
          // distributeOutcome which will retry.
          if ((retryNeeded) && (!lastParticipant)) {
              _outcome = true;
              _retryRequired = true;
  
              // check for heuristics ...
              if (HeuristicOutcome.isHeuristic(_heuristicOutcome)) {
                  switch (_heuristicOutcome) {
                      case StatefulResource.HEURISTIC_COMMIT:
                          break;
  
                      case StatefulResource.HEURISTIC_ROLLBACK:
                          final Throwable toThrow;
                          toThrow = new HeuristicRollbackException();
                          toThrow.initCause(_xaeCaught); // set xaexception as cause
                          if (tc.isEntryEnabled())
                              Tr.exit(tc, "flowCommitOnePhase", toThrow);
                          throw (HeuristicRollbackException) toThrow;
  
                      case StatefulResource.HEURISTIC_HAZARD:
                          toThrow = new HeuristicHazardException();
                          toThrow.initCause(_xaeCaught); // set xaexception as cause
                          if (tc.isEntryEnabled())
                              Tr.exit(tc, "flowCommitOnePhase", toThrow);
                          throw (HeuristicHazardException) toThrow;
  
                      default:
                          toThrow = new HeuristicMixedException();
                          toThrow.initCause(_xaeCaught); // set xaexception as cause
                          if (tc.isEntryEnabled())
                              Tr.exit(tc, "flowCommitOnePhase", toThrow);
                          throw (HeuristicMixedException) toThrow;
                  }
              }
          } else // synchronous outcome
          {
              if (HeuristicOutcome.isHeuristic(_heuristicOutcome)) {
                  switch (_heuristicOutcome) {
                      case StatefulResource.HEURISTIC_COMMIT:
                          break;
                      case StatefulResource.HEURISTIC_ROLLBACK:
                          final Throwable toThrow;
                          if (!lastParticipant) {
                              toThrow = new HeuristicRollbackException();
                              toThrow.initCause(_xaeCaught); // set xaexception as cause
                              if (tc.isEntryEnabled())
                                  Tr.exit(tc, "flowCommitOnePhase", toThrow);
                              throw (HeuristicRollbackException) toThrow;
                          }
                          if (tc.isEventEnabled())
                              Tr.event(tc, "LPS resource rolled-back heuristically.  Throwing RollbackException.");
                          toThrow = new RollbackException();
                          toThrow.initCause(_xaeCaught); // set xaexception as cause
                          if (tc.isEntryEnabled())
                              Tr.exit(tc, "flowCommitOnePhase", toThrow);
                          throw (RollbackException) toThrow;
                      case StatefulResource.HEURISTIC_HAZARD:
                          toThrow = new HeuristicHazardException();
                          toThrow.initCause(_xaeCaught); // set xaexception as cause
                          if (tc.isEntryEnabled())
                              Tr.exit(tc, "flowCommitOnePhase", toThrow);
                          throw (HeuristicHazardException) toThrow;
                      default: // Heuristic
                          toThrow = new HeuristicMixedException();
                          toThrow.initCause(_xaeCaught); // set xaexception as cause
                          if (tc.isEntryEnabled())
                              Tr.exit(tc, "flowCommitOnePhase", toThrow);
                          throw (HeuristicMixedException) toThrow;
                  } // end switch
              }
          }
  
          if (tc.isEntryEnabled())
              Tr.exit(tc, "flowCommitOnePhase");
      }