docs: public int commitLastAgent(boolean isLPS, boolean xaOKVote)
                      throws RollbackException, SystemException, HeuristicMixedException,
                      HeuristicHazardException, HeuristicRollbackException {
          if (tc.isEntryEnabled())
              Tr.entry(tc, "commitLastAgent", new Object[] { this, isLPS, xaOKVote });
  
          int result = XA_RDONLY;
  
          if (!isLPS) {
              // This is the last resource to be processed (i==0), no other resources have voted to commit
              // (okVoteCount==0), this node is in control of the transaction (!subordinate) and the resource
              // supports processing of a one phase commit flow (instance of RSOPC). Under these conditions,
              // we can drive a 1PC flow to the resource without any need to LPS logging.
  
              try {
                  flowCommitOnePhase(false);
  
                  //
                  // Set return value to ONEPHASE so that the TransactionImpl knows
                  // we have optimized.
                  //
                  result = ONE_PHASE_OPT;
              } catch (RollbackException rbe) {
                  // No FFDC Code Needed.
  
                  // We must intercept a RollbackException and convert it into a ONE_PHASE_OPT_ROLLBACK
                  // return so that TransactionImpl knows that the only resource not to vote read only
                  // has been rolledback so there is no need to distribute rollback.
                  result = ONE_PHASE_OPT_ROLLBACK;
              } finally {
                  // Heuristic cases are thrown to caller
                  if (tc.isEntryEnabled())
                      Tr.exit(tc, "commitLastAgent",
                              (result == ONE_PHASE_OPT ? "ONE_PHASE_OPT" :
                                              (result == ONE_PHASE_OPT_ROLLBACK ? "ONE_PHASE_OPT_ROLLBACK" : "HEURISTIC")));
              }
              return result;
          }
  
          // LPS case: We must be a superior or a single involved subordinate if we get to this case.
          // We have a 1PC resource enlisted at position 0 and we already have some ok votes
          // so we need to drive 1PC to find our final vote.  Check that LPS is enabled, if not
          // we will throw a RollbackException to rollback the transaction as we cannot complete it.
          try {
              // LIDB1673.22/PQ72718 - check LPS at prepare time
              if (_LPSProhibited && xaOKVote) // d250698
              {
                  Tr.error(tc, "WTRN0063_ILLEGAL_COMMIT_OF_1PC_RESOURCE");
                  logDiagnostics(JTAResourceBase.PREPARE_DIAGNOSTICS);
                  if (tc.isEventEnabled())
                      Tr.event(tc, "LPS not enabled, rolling back transaction");
                  throw new RollbackException();
              }
  
              // As we have reached element 0 all of our 2PC resource must have prepared so at this
              // point we need to force the already written resources to the log via a call to transactionImpl.
              _transaction.logLPSState();
  
              // LIDB1673-13 lps heuristic completion
              flowCommitOnePhase(true);
              // 1PC was successful so we can return a vote of XA_OK
              result = XA_OK;
          } catch (RollbackException rbe) {
              // No FFDC Code Needed.
  
              // 1PC resource has decided to rollback so we return our vote by re-throwing the
              // exception.
              if (tc.isEntryEnabled())
                  Tr.exit(tc, "commitLastAgent", rbe);
              throw rbe;
          } catch (HeuristicMixedException hme) {
              // No FFDC Code Needed.
  
              // 1PC resource has returned heuristic so return failed and let TI determine next action
              // from lpsHeuristicCompletion value
              result = ONE_PHASE_OPT_FAILED;
          } catch (HeuristicHazardException hhe) {
              // No FFDC Code Needed.
  
              // 1PC resource has returned heuristic so return failed and let TI determine next action
              // from lpsHeuristicCompletion value
              result = ONE_PHASE_OPT_FAILED;
              // 1PC resource has returned heuristic so we need to rollback all other resources and
              // rethrow the exception.
          }
          // LPS case should never throw heuristRB
          // catch (HeuristicRollbackException hre)
  
          if (tc.isEntryEnabled())
              Tr.exit(tc, "commitLastAgent", XAReturnCodeHelper.convertXACode(result));
          return result;
      }