docs: @Override
      public boolean enlistResource(XAResource xaRes) throws RollbackException, IllegalStateException, SystemException {
          if (tc.isEntryEnabled())
              Tr.entry(tc, "enlistResource (SPI)", xaRes);
  
          //
          // Check the transaction is in a valid state to allow a new resource to be enlisted.
          //
          switch (_status.getState()) {
              case TransactionState.STATE_ACTIVE: {
                  if (!_timedOut)
                      break;
              }
              case TransactionState.STATE_ROLLED_BACK:
              case TransactionState.STATE_ROLLING_BACK:
              case TransactionState.STATE_HEURISTIC_ON_ROLLBACK: {
                  RollbackException rbe = new RollbackException("Transaction rolled back");
                  FFDCFilter.processException(rbe, "com.ibm.tx.jta.TransactionImpl.enlistResource", "1760", this);
                  if (tc.isEntryEnabled())
                      Tr.exit(tc, "enlistResource (SPI)", rbe);
                  throw rbe;
              }
              default: {
                  //
                  // We do NOT allow enlistResource during preparing state.
                  //
                  final IllegalStateException ise = new IllegalStateException("Transaction is inactive or prepared");
                  FFDCFilter.processException(ise, "com.ibm.tx.jta.TransactionImpl.enlistResource", "1769", this);
                  if (tc.isEntryEnabled())
                      Tr.exit(tc, "enlistResource (SPI)", ise);
                  throw ise;
              }
          }
  
          if (xaRes == null) {
              final IllegalStateException ise = new IllegalStateException("Cannot enlist a null resource");
              if (tc.isEntryEnabled())
                  Tr.exit(tc, "enlistResource", ise);
              throw ise;
          }
  
          try {
              if (xaRes instanceof OnePhaseXAResource) {
                  getResources().enlistResource(xaRes);
              } else {
  
                  final int recoveryId = TransactionManagerFactory.getTransactionManager().registerResourceInfo("unused", new DirectEnlistXAResourceInfo(xaRes));
                  enlistResource(xaRes, recoveryId);
              }
          } catch (IllegalStateException ise) {
              FFDCFilter.processException(ise, "com.ibm.tx.jta.TransactionImpl.enlistResource", "1858", this);
              if (tc.isEntryEnabled())
                  Tr.exit(tc, "enlistResource (SPI)", ise);
              throw ise;
          } catch (Throwable t) {
              FFDCFilter.processException(t, "com.ibm.tx.jta.TransactionImpl.enlistResource", "1868", this);
              this.setRollbackOnly();
              final RollbackException rbe = new RollbackException(t.getMessage());
              rbe.initCause(t);
              if (tc.isEntryEnabled())
                  Tr.exit(tc, "enlistResource (SPI)", rbe);
              throw rbe;
          }
  
          if (tc.isEntryEnabled())
              Tr.exit(tc, "enlistResource (SPI)", Boolean.TRUE);
          return true;
      }