docs: public void commit() throws XAException
      {
          if (tc.isEntryEnabled()) Tr.entry(tc, "commit", _txn);
  
          // replay must have finished
          if (_tranManager.isReplayComplete())
          {
              final int state = _txn.getTransactionState().getState();
  
              switch (state)
              {
              case TransactionState.STATE_PREPARED :
                  try
                  {
                      // Suspend local transaction if present
                      suspend(); // @LIDB2110AA
  
                      try
                      {
                          // Resume imported transaction
                          _tranManager.resume(_txn);
                      }
                      catch (InvalidTransactionException e)
                      {
                          if (tc.isEntryEnabled()) Tr.exit(tc, "prepare", new Object[] { "resume threw InvalidTransactionException", e });
                          resume();
                          throw new XAException(XAException.XAER_RMERR);
                      }
                      catch (IllegalStateException e)
                      {
                          if (tc.isEntryEnabled()) Tr.exit(tc, "prepare", new Object[] { "resume threw IllegalStateException", e });
                          resume();
                          throw new XAException(XAException.XAER_PROTO);
                      } // @LIDB2110AA
  
                      _txn.getTransactionState().setState(TransactionState.STATE_COMMITTING);
  
                      _txn.internalCommit();
                      _txn.notifyCompletion();
                  }
                  catch (HeuristicMixedException e)
                  {
                      _heuristic = StatefulResource.HEURISTIC_MIXED;
                  }
                  catch (HeuristicHazardException e)
                  {
                      _heuristic = StatefulResource.HEURISTIC_HAZARD;
                  }
                  catch (HeuristicRollbackException e)
                  {
                      _heuristic = StatefulResource.HEURISTIC_ROLLBACK;
                  }
                  catch (SystemException e)
                  {
                      if (tc.isEntryEnabled()) Tr.exit(tc, "commit", "internalCommit threw SystemException");
                      throw new XAException(XAException.XAER_RMERR);
                  }
                  finally // @LIDB2110AA
                  {
                      // Resume local transaction if we suspended it earlier
                      resume();
                  }       // @LIDB2110AA
                  break;
  
              case TransactionState.STATE_HEURISTIC_ON_ROLLBACK :
              case TransactionState.STATE_HEURISTIC_ON_COMMIT :
                  // We had a heuristic on commit or rollback.
                  // Let's use whatever that was
                  _heuristic = _txn.getResources().getHeuristicOutcome();
                  if (tc.isDebugEnabled()) Tr.debug(tc, "Heuristic was: " + ResourceWrapper.printResourceStatus(_heuristic));
                  break;
  
              case TransactionState.STATE_COMMITTED :
              case TransactionState.STATE_COMMITTING :
                  // could be a retry, so just accept
                  break;
  
              case TransactionState.STATE_ROLLING_BACK :
              case TransactionState.STATE_ROLLED_BACK :
                  _heuristic = StatefulResource.HEURISTIC_ROLLBACK;
                  break;
  
              case TransactionState.STATE_NONE :
                  // transaction has completed and has now finished
                  break;
  
              default :
                  if (tc.isEntryEnabled()) Tr.exit(tc, "commit", "transaction is not in a prepared state");
                  throw new XAException(XAException.XAER_PROTO);
              }
  
              recordHeuristicOnCommit();
          }
          else
          {
              if (tc.isEntryEnabled()) Tr.exit(tc, "commit", "throwing XAER_RMFAIL");
              throw new XAException(XAException.XAER_RMFAIL);
          }
  
          if (tc.isEntryEnabled()) Tr.exit(tc, "commit");
      }