docs: public int prepare(Xid xid) throws XAException {
          if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
              Tr.entry(this, tc, "prepare", new Object[]
              {
               ivManagedConnection,
               AdapterUtil.toString(xid) 
                       });
  
          // if the MC marked Stale, it means the user requested a purge pool with an immediate option
          // so don't allow any work to continue.  In this case, we throw XAER_RMFAIL xa error
          // which indicates that the resource manager is not available
          if (ivManagedConnection._mcStale) {
              Tr.error(tc, "INVALID_CONNECTION");
              XAException x = new XAException(XAException.XAER_RMFAIL);
              if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
                  Tr.exit(this, tc, "prepare", new Object[] { "MC is stale throwing XAER_RMFAIL", ivManagedConnection });
              throw x;
          }
  
          if (!xid.equals(ivXid)) { 
              if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) 
                  Tr.debug(this, tc, "Xid does not match.", new Object[]
                  {
                   "XAResource.start:   ",
                   AdapterUtil.toString(ivXid), 
                   "XAResource.prepare: ",
                   AdapterUtil.toString(xid) 
                           });
  
              XAException xaX = AdapterUtil.createXAException(
                                                              "XID_MISMATCH",
                                                              new Object[] { AdapterUtil.toString(ivXid), "prepare", AdapterUtil.toString(xid) },
                                                              XAException.XAER_NOTA); 
  
              if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                  Tr.exit(this, tc, "prepare", xaX);
              throw xaX;
          }
  
          int returnValue;
  
          try {
              returnValue = ivXaRes.prepare(xid);
              //need to check the return value here and determine if we need to clean up the transaction state
              if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) 
              {
                  Tr.debug(this, tc, "xa.prepare() status:", new Object[]
                  {
                   AdapterUtil.getXAResourceVoteString(returnValue),
                   AdapterUtil.toString(xid) 
                           });
              }
  
              if (returnValue == XAException.XA_RDONLY) {
                  try {
                      //  flag is reset since no commit/rollbak is issued here
                      // adn we don't want inGlobalTransaction to return the wrong value
                      ivManagedConnection.wasLazilyEnlistedInGlobalTran = false;
  
                      ivStateManager.setState(WSStateManager.XA_READONLY);
                  } catch (TransactionException te) {
                      //Exception means setState failed because it was invalid to set the state in this case
                      FFDCFilter.processException(te, "com.ibm.ws.rsadapter.spi.WSRdbXaResourceImpl.prepare", "373", this);
  
                      XAException xae = AdapterUtil.createXAException(
                                                                      "INVALID_TX_STATE",
                                                                      new Object[] { "XAResource.prepare", ivManagedConnection.getTransactionStateAsString() },
                                                                      XAException.XA_RBPROTO); 
  
                      traceXAException(xae, currClass);
                      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                          Tr.exit(this, tc, "prepare", xae); 
                      throw xae;
                  }
              }
  
          } catch (XAException xae) {
              FFDCFilter.processException(xae, "com.ibm.ws.rsadapter.spi.WSRdbXaResourceImpl.prepare", "386", this);
              traceXAException(xae, currClass);
              checkXAException(xae); 
              if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                  Tr.exit(this, tc, "prepare", "Exception");
              throw xae;
          }
  
          if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
              Tr.exit(this, tc, "prepare", returnValue);
          return returnValue;
      }