docs: public void initializeForUOW(MCWrapper mcWrapper, boolean originIsDeferred) throws ResourceException {
  
          final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
          if (isTraceOn && tc.isEntryEnabled()) {
              Tr.entry(this, tc, "initializeForUOW");
          }
  
          boolean registeredForSync = false;
          boolean enlisted = false;
  
          UOWCoordinator uowCoord = mcWrapper.getUOWCoordinator();
  
          // See allocateMCWrapper for a discussion on the checks being done here
          if (uowCoord == null) {
  
              if (isTraceOn && tc.isDebugEnabled()) {
                  Tr.debug(this, tc, "Transaction context does NOT exist");
              }
  
              if (!mcWrapper.gConfigProps.isDynamicEnlistmentSupported()) {
  
                  if (isTraceOn && tc.isDebugEnabled()) {
                      Tr.debug(this, tc, "Not marked for dynamic transaction enlistment");
                  }
  
                  // Only log warnings or throw exception for LocalTransaction and XATransaction RAs...
                  if ((mcWrapper.gConfigProps.transactionSupport == TransactionSupport.TransactionSupportLevel.LocalTransaction) ||
                      (mcWrapper.gConfigProps.transactionSupport == TransactionSupport.TransactionSupportLevel.XATransaction)) { // 144070 WS14620.01
  
                      // deleted check for RRSTransactional support
                      if (mcWrapper.gConfigProps.logMissingTranContext) {
                          Tr.warning(tc, "MISSING_TRANSACTION_CONTEXT_J2CA0075", "initializeForUOW");
                      }
                      // Remove check for whether connector runtime supports no transaction mode
  
                  }
  
              }
  
          } else {
  
              // If there is an UOWCoordinator context then consider this ManagedConnection
              // for association with this transaction
  
              if (isTraceOn && tc.isDebugEnabled()) {
                  Tr.debug(this, tc, "Transaction context exists");
              }
  
              /*
               * If this ManagedConnection is not already associated then perform the
               * enlistment and create necessary associations. No synchronisation is
               * necessary here because we are in a global transaction context and the
               * ManagedConnection was reserved under this context and the context is
               * thread specific so no ManagedConnection can be being manipulated by
               * two threads at the saem time.
               */
  
              TranWrapper wrapper = null;
  
              // Note:  in future this logic for determining which kind of tran wrapper to create
              // Can be reorganized (see truth table)
              if (mcWrapper.isEnlistmentDisabled()) {
  
                  if (isTraceOn && tc.isDebugEnabled()) {
                      Tr.debug(this, tc, "Creating NoTransactionWrapper, since this a a non-transactional datasource");
                  }
  
                  wrapper = mcWrapper.getNoTransactionWrapper();
  
              } else { // transactional datasource
  
                  // When the adapter is RRSTransactional, if
                  // possible, perform standard J2EE local tran
                  // processing under the RRS Local tran. If not,
                  // use an RRSLocalTranactionWrapper to handle
                  // transaction processing.
                  // To determine if standard J2EE local tran
                  // processing can be performed, check if the
                  // level of J2EE transaction support defined
                  // by the adapter is one of the following:
                  // TransactionSupport.TransactionSupportLevel.LocalTransaction
                  // TransactionSupport.TransactionSupportLevel.XATransaction
                  // If not, then perform RRSLocalTransaction
                  // processing. On the other hand, if it is
                  // one of these and is not the CICS ECI
                  // resource adapter, perform J2EE Local
                  // transaction processing.
                  // In the case of the CICS ECI resource adapter,
                  // even though it indicates that it
                  // SupportsLocalTransactions, WAS z/OS cannot
                  // currently use the CICS resource adapter SPI
                  // Local Transaction Support when the adapter
                  // is running as an RRSTransactional adapter.
                  // This is because CICS attempts to establish a
                  // private transaction context with RRS and
                  // this fails because an authorized transaction
                  // context (created by WAS) already exists.
                  // To allow for the possibility that CICS could
                  // change it's support in the future, a check
                  // will be made to see if the CICS adapter
                  // supports CCI Local Transaction processing.
                  // When CICS does change it's SPI J2EE Local
                  // transaction support, it has agreed that they
                  // will also support CCI Local Transaction
                  // support at that time. Thus, if the adapter
                  // supports CCI Local Transaction processing,
                  // then it will be assumed that the SPI
                  // Local Transaction processing will now also
                  // work OK under WAS z/OS.
  
                  switch (mcWrapper.gConfigProps.transactionSupport) {
  
                      // resource adapter supports neither resource manager nor JTA transactions
                      case NoTransaction:
  
                          if (!rrsTransactional) { // No RRS-coordinated transaction support
                              if (isTraceOn && tc.isDebugEnabled()) {
                                  if (uowCoord.isGlobal()) {
                                      Tr.debug(this, tc, "Creating NoTransactionWrapper for use in Global Transaction. RA supports No Transaction.");
                                  } else {
                                      Tr.debug(this, tc, "Creating NoTransactionWrapper for use in Local Transaction. RA supports No Transaction.");
                                  }
                              }
  
                              wrapper = mcWrapper.getNoTransactionWrapper();
                          } else { // RRS-coordinated transaction support
                              if (uowCoord.isGlobal()) { // global transaction scope
                                  if (isTraceOn && tc.isDebugEnabled()) {
                                      Tr.debug(this, tc, "Creating RRSGlobalTransactionWrapper for use in Global Transaction. RA supports RRS Coordinated Transactions.");
                                  }
                                  wrapper = mcWrapper.getRRSGlobalTransactionWrapper();
                              } else { // local transaction scope
                                  if (!localTranSupportSet) {
                                      mcWrapper.gConfigProps.setLocalTranSupport(false); // not CICS ECI resource adapter
                                      localTranSupportSet = true;
                                  }
                                  if (mcWrapper.gConfigProps.cciLocalTranSupported) { // CICS ECI resource adapter
                                      if (isTraceOn && tc.isDebugEnabled()) {
                                          Tr.debug(this, tc, "Creating LocalTransactionWrapper for use in Local Transaction under RRSTransactional adapter.");
                                      }
                                      wrapper = mcWrapper.getLocalTransactionWrapper(rrsTransactional);
                                  } else { // not CICS ECI resource adapter
                                      if (isTraceOn && tc.isDebugEnabled()) {
                                          Tr.debug(this, tc, "Creating RRSLocalTransactionWrapper for use in Local Transaction under RRSTransactional adapter.");
                                      }
                                      wrapper = mcWrapper.getRRSLocalTransactionWrapper();
                                  }
                              } // end local scope
                          } // end RRS-coordinated
  
                          break;
  
                      // resource adapter supports resource manager local transactios
                      case LocalTransaction:
  
                          if (!rrsTransactional) { // No RRS-coordinated transaction support
                              if (isTraceOn && tc.isDebugEnabled()) {
                                  if (uowCoord.isGlobal()) { // global transaction scope
                                      Tr.debug(this, tc, "Creating LocalTransactionWrapper for use in Global Transaction. RA supports Local Transaction.");
                                  } else { // local transaction scope
                                      Tr.debug(this, tc, "Creating LocalTransactionWrapper for use in Local Transaction. RA supports Local Transaction.");
                                  }
                              } // end if (TraceComponent.isAnyTracingEnabled()  && tc.isDebugEnabled())
                              wrapper = mcWrapper.getLocalTransactionWrapper();
                          } else { // RRS-coordinated transaction support
                              if (uowCoord.isGlobal()) { // global transaction scope
                                  if (isTraceOn && tc.isDebugEnabled()) {
                                      Tr.debug(this, tc, "Creating RRSGlobalTransactionWrapper for use in Global Transaction. RA supports RRS Coordinated Transactions.");
                                  }
                                  wrapper = mcWrapper.getRRSGlobalTransactionWrapper();
                              } else { // local transaction scope
                                  if (!localTranSupportSet) {
                                      String mcfClass = mcWrapper.get_managedConnectionFactory().getClass().getName();
                                      if (mcfClass.equals("com.ibm.connector2.cics.ECIManagedConnectionFactory")) {
                                          mcWrapper.gConfigProps.setLocalTranSupport(raSupportsCCILocalTran(mcWrapper.get_managedConnectionFactory()));
                                          localTranSupportSet = true;
  
                                      }
                                  }
  
                                  if (mcWrapper.gConfigProps.cciLocalTranSupported) { // CICS ECI resource adapter
                                      if (isTraceOn && tc.isDebugEnabled()) {
                                          Tr.debug(this, tc, "Creating LocalTransactionWrapper for use in Local Transaction under RRSTransactional adapter.");
                                      }
                                      wrapper = mcWrapper.getLocalTransactionWrapper(rrsTransactional);
                                  } else { // not CICS ECI resource adapter
                                      if (isTraceOn && tc.isDebugEnabled()) {
                                          Tr.debug(this, tc, "Creating RRSLocalTransactionWrapper for use in Local Transaction under RRSTransactional adapter.");
                                      }
                                      wrapper = mcWrapper.getRRSLocalTransactionWrapper();
                                  }
                              } // end else (local scopr)
                          } // end else (RRS-coordinated)
  
                          break;
  
                      // resource adapter supports both resource manager local and JTA transactions
                      case XATransaction:
  
                          if (!rrsTransactional) { // No RRS-coordinated transaction support
                              if (uowCoord.isGlobal()) { // global transaction scope
                                  if (isJDBC && mcWrapper.getManagedConnection().getXAResource() instanceof com.ibm.tx.jta.OnePhaseXAResource) {
                                      if (isTraceOn && tc.isDebugEnabled()) {
                                          Tr.debug(this, tc, "Creating LocalTransactionWrapper for use in Global Transaction.  The resource adapter supports XA Transaction");
                                      }
                                      wrapper = mcWrapper.getLocalTransactionWrapper();
                                  } else { // xaResource is two-phase
                                      if (isTraceOn && tc.isDebugEnabled()) {
                                          Tr.debug(this, tc, "Creating XATransactionWrapper for use in Global Transaction.  The resource adapter supports XA Transaction");
                                      }
                                      wrapper = mcWrapper.getXATransactionWrapper();
                                  }
                              } // end of global transaction scope
                              else { // local transaction scope
                                  if (isTraceOn && tc.isDebugEnabled()) {
                                      Tr.debug(this, tc, "Creating LocalTransactionWrapper for use in Local Transaction. The resource adapter supports XA Transaction.");
                                  }
                                  wrapper = mcWrapper.getLocalTransactionWrapper();
                              }
                          } else { // RRS-coordinated transaction support
                              if (uowCoord.isGlobal()) { // global transaction scope
                                  if (isTraceOn && tc.isDebugEnabled()) {
                                      Tr.debug(this, tc, "Creating RRSGlobalTransactionWrapper for use in Global Transaction. RA supports RRS Coordinated Transactions.");
                                  }
                                  wrapper = mcWrapper.getRRSGlobalTransactionWrapper();
                              } else { // local transaction scope
                                  if (!localTranSupportSet) {
                                      String mcfClass = mcWrapper.get_managedConnectionFactory().getClass().getName();
                                      if (mcfClass.equals("com.ibm.connector2.cics.ECIManagedConnectionFactory")) {
                                          mcWrapper.gConfigProps.setLocalTranSupport(raSupportsCCILocalTran(mcWrapper.get_managedConnectionFactory()));
                                          localTranSupportSet = true;
                                      }
                                  }
                                  if (mcWrapper.gConfigProps.cciLocalTranSupported) { // CICS ECI resource adapter
                                      if (isTraceOn && tc.isDebugEnabled()) {
                                          Tr.debug(this, tc, "Creating LocalTransactionWrapper for use in Local Transaction under RRSTransactional adapter.");
                                      }
                                      wrapper = mcWrapper.getLocalTransactionWrapper(rrsTransactional);
                                  } else { // Not CICS ECI resource adapter
                                      wrapper = mcWrapper.getRRSLocalTransactionWrapper();
                                      if (isTraceOn && tc.isDebugEnabled()) {
                                          Tr.debug(this, tc, "Created RRSLocalTransactionWrapper for use in Local Transaction under RRSTransactional adapter.");
                                      }
                                  }
                              } // end local scope
                          } // end RRS-coordinated transaction support
  
                          break;
                      default:
                  } // end of switch
              } // end else transactional datasource
  
              if (isTraceOn && tc.isDebugEnabled()) {
                  Tr.debug(this, tc, "Created transaction wrapper@" + Integer.toHexString(wrapper.hashCode()));
              }
  
              /*
               * If we experience a problem during the addSync we won't have registered for synchronisation
               * so we need to tidy up properly here. Once we have registered for synchronisation we can always
               * tidy up at transaction completion.
               */
  
              try {
                  registeredForSync = wrapper.addSync();
                  // TODO The following code would exit regardless if we just registered for
                  // synchronization in an LTC or a global transaction.  Is that what we want?
                  // We're waiting for some data from JetStream or Transactions to determine
                  // the proper course of action.
                  if (mcWrapper.isConnectionSynchronizationProvider()) {
                      /*
                       * If this is a connection synchronization provider, they are
                       * resposible for all of the remaining transactions work.
                       */
                      if (isTraceOn && tc.isDebugEnabled()) {
                          Tr.debug(this, tc, "This managed connection is a synchronization provider.");
                      }
                      if (isTraceOn && tc.isEntryEnabled()) {
                          Tr.exit(this, tc, "initializeForUOW");
                      }
                      return;
                  }
  
              } catch (ResourceException e) {
  
                  // Note: the wrapper handles all the appropriate logging of the exception.
                  //  We catch it here so that we can do the appropriate cleanup.
                  com.ibm.ws.ffdc.FFDCFilter.processException(e, "com.ibm.ejs.j2c.ConnectionManager.initializeForUOW", "730", this);
                  if (isTraceOn && tc.isDebugEnabled())
                      Tr.debug(this, tc, "Exception:" + e);
                  try {
                      mcWrapper.releaseToPoolManager();
                  } catch (Exception ex) { // ignore.
                  }
                  throw e;
  
              } // end catch ResourceException
  
              //NOTE: only global transactions or local transaction with resolution control 'container at boundary'
              //  will be enlisted during allocate.
              //  Local transactions with resolution control 'application' will be enlisted during the
              //  localTransactionStarted event on the connectionEventListner.
  
              try {
  
                  if (uowCoord != null) {
  
                      if (uowCoord.isGlobal()) {
  
                          // In global tran.
  
                          // If deferred enlistment is supported by the RA, then enlistment in a global tran
                          // will happen in the interactionPending() method of the ConnectionEventListener.
                          // Otherwise, enlist here.
                          //
                          // RRS Global Trans will opt out of deferred enlistment because in some cases it will be
                          //  necessary to track states via the enlistment, and this needs to be done as soon as
                          //  the connection is obtained
  
                          if (!mcWrapper.gConfigProps.isDynamicEnlistmentSupported() || rrsTransactional) {
  
                              wrapper.enlist();
                              enlisted = true;
  
                          }
  
                      } else {
  
                          // delete check for rrsTransactional
                          if (J2CUtilityClass.isContainerAtBoundary(mcWrapper.pm.connectorSvc.transactionManager)) {
                              // LTC with resolution of ContainerAtBoundary. Agressively enlist in the transaction.
                              wrapper.enlist();
                              enlisted = true;
                          }
  
                      }
                  }
  
              } // end try
              catch (ResourceException e) {
  
                  // NOTE: we only need to catch ResourceException here because our wrapper
                  //  code only throws resource exceptions.
  
                  // clean everything up!
                  com.ibm.ws.ffdc.FFDCFilter.processException(e, "com.ibm.ejs.j2c.ConnectionManager.initializeForUOW", "762", this);
  
                  // Only mark stale and throw exception at this time since we've already registered
                  // for synchronization.  Allow the transaction to be rolled back to clean this up.
                  // mcWrapper.markStale(); 154675 - already marked stale
                  // mcWrapper.releaseToPoolManager();
  
                  if (isTraceOn && tc.isEntryEnabled()) {
                      Tr.exit(this, tc, "initializeForUOW", "completed cleanup due to exception.");
                  }
                  throw e;
  
              } // end catch ResourceException
  
          } // end UOW.GLOBAL_TRAN_ACTIVE
  
          // If we have not registered for Synchronization and have not enlisted, then we
          // are not involved in any way with the current transaction, thus we need to reset the
          // UOWCoord in the mcWrapper so that deferred enlistment will work for JMS.
          if (!registeredForSync && !enlisted && !originIsDeferred) {
              mcWrapper.setUOWCoordinator(null);
          }
  
          if (isTraceOn && tc.isEntryEnabled()) {
              Tr.exit(this, tc, "initializeForUOW");
          }
  
      }