docs: @Override
      public boolean delistResource(XAResource xaRes, int flag) throws IllegalStateException, SystemException {
          if (tc.isEntryEnabled())
              Tr.event(tc, "delistResource (SPI)", new Object[] { xaRes, Util.printFlag(flag) });
  
          //
          // Check the transaction is in a valid state to allow a resource to be delisted.
          //
          if (_status.getState() != TransactionState.STATE_ACTIVE) {
              final String msg = "Transaction is inactive or prepared";
              final IllegalStateException ise = new IllegalStateException(msg);
              FFDCFilter.processException(ise, "com.ibm.tx.jta.TransactionImpl.delistResource", "2212", this);
              if (tc.isEntryEnabled())
                  Tr.exit(tc, "delistResource (SPI)", ise);
              throw ise;
          }
  
          // XAResource is null throw exception.
          if (xaRes == null) {
              final String msg = "XAResource reference is null";
              final IllegalStateException ise = new IllegalStateException(msg);
              FFDCFilter.processException(ise, "com.ibm.tx.jta.TransactionImpl.delistResource", "2224", this);
              if (tc.isEntryEnabled())
                  Tr.exit(tc, "delistResource (SPI)", ise);
              throw ise;
          }
  
          // try to end transaction association using specified flag.
          boolean delisted = false;
          try {
              delisted = getResources().delistResource(xaRes, flag);
          } catch (SystemException se) {
              FFDCFilter.processException(se, "com.ibm.tx.jta.TransactionImpl.delistResource", "1928", this);
              throw se;
          } finally {
              if (tc.isEntryEnabled())
                  Tr.exit(tc, "delistResource", new Object[] { "(SPI)", delisted });
          }
  
          return delisted;
      }