This method is used to create a LocalResource that can either be enlisted as
a particpant in a WebSphere LocalTransactionCoordination scope or used directly
to demarcate a one-phase Resource Manager Local Transaction.

@return An instance of Object
161426
public ExternalLocalTransaction createLocalTransaction()
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createLocalTransaction");

        ExternalLocalTransaction instance;
        
        if (_persistenceSupports1PCOptimisation)
        {
            instance = new MSDelegatingLocalTransactionSynchronization(_ms, _persistence, getMaximumTransactionSize());
        }
        else
        {
            instance = new MSDelegatingLocalTransaction(_ms, _persistence, getMaximumTransactionSize());
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createLocalTransaction", "return="+instance);
        return instance;
    }
1024664
public void processLocalTransactionCommittedEvent(Object handle) throws ResourceException {
        // A application level local transaction has been committed.

        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();

        if (isTraceOn) 
        {
            if (tc.isEntryEnabled()) 
                Tr.entry(this, tc, "processLocalTransactionCommittedEvent", handle);

            if (tc.isDebugEnabled()) 
            { 
                String cId = null;
                try {
                    cId = mcf.getCorrelator(this); 
                } catch (SQLException x) {
                    // will just log the exception here and ignore it since its in trace
                    Tr.debug(this, tc, "got an exception trying to get the correlator in commit, exception is: ", x);
                }

                if (cId != null) {
                    StringBuffer stbuf = new StringBuffer(200);
                    stbuf.append("Correlator: DB2, ID: ");
                    stbuf.append(cId);
                    if (xares != null) {
                        stbuf.append(" Transaction : ");
                        stbuf.append(xares);
                    }
                    stbuf.append(" COMMIT");
                    Tr.debug(this, tc, stbuf.toString());
                }
            } 
        }

        ResourceException re = stateMgr.isValid(WSStateManager.LT_COMMIT);
        if (re == null) {
            // If no work was done during the transaction, the autoCommit value may still be
            // on.  In this case, just no-op, since some drivers like ConnectJDBC 3.1 don't
            // allow commit/rollback when autoCommit is on.  

            if (!currentAutoCommit)
                try { // autoCommit is off
                    sqlConn.commit();
                } catch (SQLException se) {
                    FFDCFilter.processException(se, "com.ibm.ws.rsadapter.spi.WSRdbManagedConnectionImpl.processLocalTransactionCommittedEvent", "554", this);
                    throw AdapterUtil.translateSQLException(se, this, true, getClass());
                }

            //Set the state only after the commit has succeeded.  Else, we change the
            // state but it has not yet been committed. - a real mess

            // Already validated the state so just set it. 
            stateMgr.transtate = WSStateManager.NO_TRANSACTION_ACTIVE;
        } else {
            throw re;
        }

        // Fill in the ConnectionEvent only if needed. 
        connEvent.recycle(ConnectionEvent.LOCAL_TRANSACTION_COMMITTED, null, handle);

        if (isTraceOn && tc.isEventEnabled())
            Tr.event(this, tc, 
                     "Firing LOCAL TRANSACTION COMMITTED event for: " + handle,
                     this);

        // loop through the listeners
        for (int i = 0; i < numListeners; i++) {
            // send Local Transaction Committed event to the current listener
            ivEventListeners[i].localTransactionCommitted(connEvent); 
        }

        // Reset the indicator so lazy enlistment will be signaled if we end up in a
        // Global Transaction. 
        wasLazilyEnlistedInGlobalTran = false;

        // Replace ConnectionEvent caching with a single reusable instance per
        // ManagedConnection. 

        if (isTraceOn && tc.isEntryEnabled()) 
        {
            Tr.exit(this, tc, "processLocalTransactionCommittedEvent");
        }
    }
1113363
@Override
    public TransactionManagerAdapter getTransactionManager(StepContext stepContext) throws TransactionManagementException {
        logger.entering(CLASSNAME, "getTransactionManager", stepContext);

        TransactionManagerAdapter transactionManager = null;

        // get the JTA tran manager if we are in Java EE
        if (! this.batchConfig.isJ2seMode()) {
            // use the container JNDI java:comp/UserTransaction
            logger.fine("getting transaction object from JNDI java:comp/UserTransaction");
            transactionManager = new JTAUserTransactionAdapter("java:comp/UserTransaction");
        } 
        else if (this.batchConfig.isJ2seMode()) { 
        // If we are in J2SE mode use the non-transactional manager
        
            // java environment is Java SE
            // NoOp transaction manager
            logger.fine("J2SE mode non-transactional manager");
            transactionManager = new DefaultNonTransactionalManager();
        }

        logger.exiting(CLASSNAME, "getTransactionManager", transactionManager);
        return transactionManager;
    }
617159
public CreateTransactionResult createTransaction(
            final long connectionId,
            final long txnId,
            final long uniqueId,
            final StoredProcedureInvocation invocation,
            final boolean isReadOnly,
            final boolean isSinglePartition,
            final boolean isEveryPartition,
            final int[] partitions,
            final int messageSize,
            long nowNanos,
            final boolean isForReplay)
    {
        assert(!isSinglePartition || (partitions.length == 1));
        final ClientInterfaceHandleManager cihm = m_cihm.get(connectionId);
        if (cihm == null) {
            hostLog.rateLimitedLog(60, Level.WARN, null,
                    "InvocationDispatcher.createTransaction request rejected. "
                    + "This is likely due to VoltDB ceasing client communication as it "
                    + "shuts down.");
            return CreateTransactionResult.NO_CLIENT_HANDLER;
        }

        Long initiatorHSId = null;
        boolean isShortCircuitRead = false;
        /*
         * Send the read to the partition leader only
         * @MigratePartitionLeader always goes to partition leader
         */
        if (isSinglePartition && !isEveryPartition) {
            initiatorHSId = m_cartographer.getHSIdForSinglePartitionMaster(partitions[0]);
        } else {
            // Multi-part transactions go to the multi-part coordinator
            initiatorHSId = m_cartographer.getHSIdForMultiPartitionInitiator();

            // Treat all MP reads as short-circuit since they can run out-of-order
            // from their arrival order due to the MP Read-only execution pool
            if (isReadOnly) {
                isShortCircuitRead = true;
            }
        }

        if (initiatorHSId == null) {
            hostLog.rateLimitedLog(60, Level.INFO, null,
                    "InvocationDispatcher.createTransaction request rejected. "
                    + "This is likely due to parition leader being removed during elastic shrink.");
            return CreateTransactionResult.PARTITION_REMOVED;
        }

        long handle = cihm.getHandle(isSinglePartition, isSinglePartition ? partitions[0] : -1, invocation.getClientHandle(),
                messageSize, nowNanos, invocation.getProcName(), initiatorHSId, isShortCircuitRead);

        Iv2InitiateTaskMessage workRequest =
            new Iv2InitiateTaskMessage(m_siteId,
                    initiatorHSId,
                    Iv2InitiateTaskMessage.UNUSED_TRUNC_HANDLE,
                    txnId,
                    uniqueId,
                    isReadOnly,
                    isSinglePartition,
                    (partitions == null) || (partitions.length < 2) ? null : partitions,
                    invocation,
                    handle,
                    connectionId,
                    isForReplay);

        Long finalInitiatorHSId = initiatorHSId;
        final VoltTrace.TraceEventBatch traceLog = VoltTrace.log(VoltTrace.Category.CI);
        if (traceLog != null) {
            traceLog.add(() -> VoltTrace.instantAsync("inittxn",
                                                      invocation.getClientHandle(),
                                                      "clientHandle", Long.toString(invocation.getClientHandle()),
                                                      "ciHandle", Long.toString(handle),
                                                      "partitions", partitions.toString(),
                                                      "dest", CoreUtils.hsIdToString(finalInitiatorHSId)));
        }

        Iv2Trace.logCreateTransaction(workRequest);
        m_mailbox.send(initiatorHSId, workRequest);
        return CreateTransactionResult.SUCCESS;
    }
44981
@Override
    public Object createLocalBusinessObject(int interfaceIndex, ManagedObjectContext context)
                    throws RemoteException,
                    CreateException
    {
        return createBusinessObject(null, false);
    }
486372
public EJBLocalObject getLocalObject()
    {
        if (localObject != null)
        {
            if (localWrapperProxyState != null &&
                localWrapperProxyState.ivWrapper == null)
            {
                localWrapperProxyState.connect(ivBeanId, localWrapper);
            }
            return localObject;
        }

        throw new IllegalStateException("Local interface not defined");
    }
318487
@Override
    public void localTransactionCommitted(ConnectionEvent event) {

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(this, tc, "localTransactionCommitted");
        }

        if (event.getId() == ConnectionEvent.LOCAL_TRANSACTION_COMMITTED) {

            if (mcWrapper.involvedInTransaction()) {

                /*
                 * The ManagedConnection is associated with a transaction.
                 * Delist the ManagedConnection from the transaction and
                 * postpone release of the connection until transaction finishes.
                 */

                TranWrapper wrapper = null;
                try {
                    wrapper = mcWrapper.getCurrentTranWrapper();
                    wrapper.delist();
                } catch (ResourceException e) {
                    // Can't delist, something went wrong.
                    //  Destroy the connection(s) so it can't cause any future problems.
                    FFDCFilter.processException(e, "com.ibm.ejs.j2c.ConnectionEventListener.localTransactionCommitted", "316", "this");
                    // add datasource name to message
                    Tr.error(tc, "DELIST_FAILED_J2CA0073", "localTransactionCommitted", e, mcWrapper.gConfigProps.cfName);
                    // Moved event.getSource() inside of catch block for performance reasons
                    ManagedConnection mc = null;
                    try {
                        mc = (ManagedConnection) event.getSource();
                    } catch (ClassCastException cce) {
                        Tr.error(tc, "GET_SOURCE_CLASS_CAST_EXCP_J2CA0098", cce);
                        throw new IllegalStateException("ClassCastException occurred attempting to cast event.getSource to ManagedConnection");
                    }
                    ConnectionEvent errorEvent = new ConnectionEvent(mc, ConnectionEvent.CONNECTION_ERROR_OCCURRED);
                    this.connectionErrorOccurred(errorEvent);
                    RuntimeException rte = new IllegalStateException(e.getMessage());
                    throw rte;
                }
            } else {
                // if we are not involved in a transaction, then we are likely running with NO transaction
                //  context on the thread.  This case currently needs to be supported because
                //  servlets can spin their own threads which would not have context.
                // Note: it is very rare that users do this.  All other occurances are
                //  considered to be an error.
                if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
                    Tr.exit(this, tc, "localTransactionCommitted", "no transaction context, return without delisting");
                }
                return;
            }
        } else {
            // Connection Event passed in doesn't match the method called.
            // This should never happen unless there is an error in the ResourceAdapter.
            processBadEvent("localTransactionCommitted", ConnectionEvent.LOCAL_TRANSACTION_COMMITTED, event);
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(this, tc, "localTransactionCommitted");
        }
        return;

    }
659462
public TransactionContext createTransactionContext() {
    transactionContext = dataFabricFacade.createTransactionManager();
    for (TransactionAware transactionAware : transactionAwares) {
      this.transactionContext.addTransactionAware(transactionAware);
    }
    return transactionContext;
  }
1256619
protected int getTransactionIsolation(final String dataSourceName) {
		Map<String, String> props = getConnPropsByDataSourceName(dataSourceName);
		String val = props.get(PROPS_TRANSACTION_ISOLATION);
		return val == null ? -1 : Integer.parseInt(val);
	}
835644
public final Transaction getTransaction()
                    throws ObjectManagerException
    {
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.entry(this, cclass
                        , "getTransaction"
                            );
        // If the log is full introduce a delay for a checkpoiunt before allowing the 
        // application to proceed.
        objectManagerState.transactionPacing();
        Transaction transaction = objectManagerState.getTransaction();

        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.exit(this, cclass
                       , "getTransaction"
                       , "returns transaction=" + transaction + "(Transaction)"
                            );
        return transaction;
    }
1242642
private TransactionalDataSource getTransactionalDataSource(
            ODataRequestContext odataRequestContext, Type type) throws ODataException {
        DataSource dataSource = dataSourceFactory.getDataSource(odataRequestContext, type.getFullyQualifiedName());
        String dataSourceKey = dataSource.getClass().toString();
        if (dataSourceMap.containsKey(dataSourceKey)) {
            return dataSourceMap.get(dataSourceKey);
        } else {
            TransactionalDataSource transactionalDataSource = dataSource.startTransaction();

            dataSourceMap.put(dataSourceKey, transactionalDataSource);
            return transactionalDataSource;
        }
    }
733704
public function locally()
    {
        list(
            $this->item,
            $this->itemIterator,
            $this->itemIteratorTotal,
            $this->popIndex,
            $this->upIndex,
            $this->currentIndex
        ) = $this->itemStack[$this->localIndex];

        // Remember any  un-completed (resetLocalScope hasn't been called) lookup chain. Even if there isn't an
        // un-completed chain we need to store an empty item, as resetLocalScope doesn't know the difference later
        $this->localStack[] = array_splice($this->itemStack, $this->localIndex + 1);

        return $this;
    }
788809
final LocalTransactionCoordinator suspendLocalTx()
    {
        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
        if (isTraceOn && tc.isEventEnabled())
        {
            LocalTransactionCoordinator currentLTC = ltcCurrent.getLocalTranCoord();
            if (currentLTC != null)
            {
                Tr.event(tc, "Suspending LTC cntxt: tid=" + Integer.toHexString(currentLTC.hashCode()) + "(LTC)");
            }
        }

        LocalTransactionCoordinator suspendedLocalTx = ltcCurrent.suspend();

        if (isTraceOn && suspendedLocalTx != null && TETxLifeCycleInfo.isTraceEnabled()) // d171555
        {
            TETxLifeCycleInfo.traceLocalTxSuspend("" + System.identityHashCode(suspendedLocalTx), "Suspend Local Tx");
        }

        return suspendedLocalTx;
    }
65470
public static PlanExecutor createLocalExecutor() {
		Class<? extends PlanExecutor> leClass = loadExecutorClass(LOCAL_EXECUTOR_CLASS);
		
		try {
			return leClass.newInstance();
		}
		catch (Throwable t) {
			throw new RuntimeException("An error occurred while loading the local executor (" + LOCAL_EXECUTOR_CLASS + ").", t);
		}
	}
867673
public void createLocalDurableSubscription(
                                               ConsumerDispatcherState subState,
                                               TransactionCommon transaction)
                    throws
                    SIDurableSubscriptionAlreadyExistsException,
                    SIDiscriminatorSyntaxException,
                    SISelectorSyntaxException,
                    SIResourceException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(
                        tc,
                        "createLocalDurableSubscription",
                        new Object[] { subState, transaction });

        // Create new getCursor and consumer dispatchers to return to the calling method
        ConsumerDispatcher consumerDispatcher = null;

        /*
         * Lock the list of durable subscriptions to prevent others creating/using an
         * identical subscription
         */
        synchronized (_consumerDispatchersDurable)
        {
            // If there's already a consumer dispatcher with this client name, then the
            // create must fail according to the current core API semantics.
            consumerDispatcher = getDurableSubscriptionConsumerDispatcher(subState);

            if (consumerDispatcher != null)
            {
                if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                    SibTr.exit(
                               tc,
                               "createLocalDurableSubscription",
                               "Sub Already Exists - " + subState);

                throw new SIDurableSubscriptionAlreadyExistsException(
                                nls.getFormattedMessage(
                                                        "SUBSCRIPTION_ALREADY_EXISTS_ERROR_CWSIP0143",
                                                        new Object[] {
                                                                      subState.getSubscriberID(),
                                                                      _messageProcessor.getMessagingEngineName() },
                                                        null));
            }
            /* We did not find the consumerDispatcher so we create it */

            /*
             * If a transaction was not provided...
             * Create a new LocalTransaction to perform the creation of a durable subscription.
             * Operations will include the creation of the itemstream,the persisting of
             * the durable state and the attaching of the consumerpoint.
             */
            boolean tranProvided = true;
            LocalTransaction siTran = null;

            if (transaction == null)
            {
                tranProvided = false;
                siTran =
                                _baseDestinationHandler
                                                .getTransactionManager()
                                                .createLocalTransaction(false);
                transaction = siTran;
            }

            /*
             * Create the consumerDispatcher, note we do not require this to be done under
             * the localTransaction. If something goes wrong after this operation, the
             * consumerDispatcher will be lost but thats ok.
             */

            Transaction msTran = _messageProcessor.resolveAndEnlistMsgStoreTransaction(transaction);

            try
            {
                /*
                 * Create a reference stream to be used by the durable subscription's
                 * consumer dispatcher
                 */
                final DurableSubscriptionItemStream durableSubscriptionReferenceStream =
                                new DurableSubscriptionItemStream(
                                                subState,
                                                _baseDestinationHandler.getDestinationManager(),
                                                _pubsubMessageItemStream,
                                                msTran);

                /* Create the consumer dispatcher to represent the subscription */
                consumerDispatcher =
                                configureDurableSubscription(durableSubscriptionReferenceStream);
                consumerDispatcher.registerControlAdapterAsMBean();

                //Venu mock mock
                // No ProxyHandler .. so commenting our this 
                /*
                 * // 166833.2
                 * // Generate the subscribeEvent for this new subscription
                 * // to see if this needs to be forwarded to a Neighbouring ME.
                 * _messageProcessor.getProxyHandler().subscribeEvent(
                 * subState,
                 * msTran);
                 */
            } catch (OutOfCacheSpace e)
            {
                // No FFDC code needed
                SibTr.exception(tc, e);
                // Rollback the transaction
                if (!tranProvided)
                    _baseDestinationHandler.handleRollback(siTran);
                if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                    SibTr.exit(
                               tc,
                               "createLocalDurableSubscription",
                               "SIResourceException");
                throw new SIResourceException(
                                nls.getFormattedMessage(
                                                        "SUBSCRIPTION_CREATION_FAILED_CWSIP0033",
                                                        new Object[] {
                                                                      _baseDestinationHandler.getName(),
                                                                      subState.getSubscriberID(),
                                                                      e },
                                                        null),
                                e);

            } catch (MessageStoreException e)
            {
                // MessageStoreException shouldn't occur so FFDC.
                FFDCFilter.processException(
                                            e,
                                            "com.ibm.ws.sib.processor.impl.destination.PubSubRealization.createLocalDurableSubscription",
                                            "1:1093:1.35.2.4",
                                            this);
                SibTr.exception(tc, e);
                // Rollback the transaction
                if (!tranProvided)
                    _baseDestinationHandler.handleRollback(siTran);

                /*
                 * The message store has thrown an exception, which leaves us stuck. Record an ffst,
                 * write a trace record and throw a SIResourceException to the caller.
                 */
                if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                    SibTr.exit(tc, "createLocalDurableSubscription", e);

                SibTr.error(
                            tc,
                            "INTERNAL_MESSAGING_ERROR_CWSIP0003",
                            new Object[] {
                                          "com.ibm.ws.sib.processor.impl.destination.PubSubRealization.createLocalDurableSubscription",
                                          "1:1112:1.35.2.4",
                                          e,
                                          _baseDestinationHandler.getName() });

                throw new SIResourceException(
                                nls.getFormattedMessage(
                                                        "INTERNAL_MESSAGING_ERROR_CWSIP0003",
                                                        new Object[] {
                                                                      "com.ibm.ws.sib.processor.impl.destination.PubSubRealization",
                                                                      "1:1121:1.35.2.4",
                                                                      e,
                                                                      _baseDestinationHandler.getName() },
                                                        null),
                                e);
            } catch (SIDiscriminatorSyntaxException e)
            {
                // No FFDC code needed
                _baseDestinationHandler.handleRollback(siTran);
                if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                    SibTr.exit(tc, "createLocalDurableSubscription", e);
                throw e;
            } catch (SISelectorSyntaxException e)
            {
                // No FFDC code needed
                _baseDestinationHandler.handleRollback(siTran);
                if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                    SibTr.exit(tc, "createLocalDurableSubscription", e);
                throw e;
            }
            //Venu mock mock
            //commenting out as this exception became unreachable
            /*
             * catch (SIResourceException e)
             * {
             * // No FFDC code needed
             * _baseDestinationHandler.handleRollback(siTran);
             * if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
             * SibTr.exit(tc, "createLocalDurableSubscription", e);
             * throw e;
             * }
             */
            catch (RuntimeException e)
            {
                // FFDC
                FFDCFilter.processException(
                                            e,
                                            "com.ibm.ws.sib.processor.impl.destination.PubSubRealization.createLocalDurableSubscription",
                                            "1:1153:1.35.2.4",
                                            this);

                if (siTran != null)
                    _baseDestinationHandler.handleRollback(siTran);
                if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                    SibTr.exit(tc, "createLocalDurableSubscription", e);
                throw e;
            }

            if (!tranProvided)
            {
                /*
                 * If no transaction was provided, this call must have been made from
                 * the core api (i.e. JMS). We can not provide transaction at runtime.
                 * Since we are creating via JMS, we need to attach the consumer
                 * as part of the create operation.
                 */
                try
                {

                    /* We have our own transaction so commit it here */
                    siTran.commit();

                } catch (SIException e)
                {
                    // MessageStoreException shouldn't occur so FFDC.
                    FFDCFilter.processException(
                                                e,
                                                "com.ibm.ws.sib.processor.impl.destination.PubSubRealization.createLocalDurableSubscription",
                                                "1:1182:1.35.2.4",
                                                this);

                    SibTr.exception(tc, e);
                    SibTr.error(
                                tc,
                                "INTERNAL_MESSAGING_ERROR_CWSIP0003",
                                new Object[] {
                                              "com.ibm.ws.sib.processor.impl.destination.PubSubRealization",
                                              "1:1191:1.35.2.4",
                                              e,
                                              _baseDestinationHandler.getName() });

                    // Failed to attach consumer, rollback the creation of the durable sub
                    // and throw exception.
                    _baseDestinationHandler.handleRollback(siTran);

                    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                        SibTr.exit(tc, "createLocalDurableSubscription", e);

                    throw new SIResourceException(
                                    nls.getFormattedMessage(
                                                            "INTERNAL_MESSAGING_ERROR_CWSIP0003",
                                                            new Object[] {
                                                                          "com.ibm.ws.sib.processor.impl.destination.PubSubRealization",
                                                                          "1:1207:1.35.2.4",
                                                                          e,
                                                                          _baseDestinationHandler.getName() },
                                                            null),
                                    e);
                }
            }
            // Transaction was provided

        } // Release the durable subs lock

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "createLocalDurableSubscription");
    }
1057828
@Override
    public TransactionSupportLevel getTransactionSupport() {
        // If ManagedConnectionFactory implements TransactionSupport, that takes priority
        TransactionSupportLevel transactionSupport = mcf instanceof TransactionSupport ? ((TransactionSupport) mcf).getTransactionSupport() : null;

        // Otherwise get the value from the deployment descriptor
        String prop = (String) bootstrapContextRef.getReference().getProperty(TRANSACTION_SUPPORT);
        if (prop != null) {
            TransactionSupportLevel ddTransactionSupport = TransactionSupportLevel.valueOf(prop);
            if (transactionSupport == null)
                transactionSupport = ddTransactionSupport;
            else if (transactionSupport.ordinal() > ddTransactionSupport.ordinal())
                throw new IllegalArgumentException(ManagedConnectionFactory.class.getName() + ':' + transactionSupport
                                                   + ", " + Connector.class.getName() + ':' + ddTransactionSupport);
        }

        if (connectionFactoryTransactionSupport != null) {
            if (connectionFactoryTransactionSupport.ordinal() > transactionSupport.ordinal())
                throw new IllegalArgumentException(ManagedConnectionFactory.class.getName() + ':' + transactionSupport
                                                   + ", " + Connector.class.getName() + ':' + connectionFactoryTransactionSupport);
            else
                transactionSupport = connectionFactoryTransactionSupport;
        }

        // Otherwise choose NoTransaction
        return transactionSupport == null ? TransactionSupportLevel.NoTransaction : transactionSupport;
    }
76753
protected void markLocalTransactionWrapperInUse() throws ResourceException {

        final boolean isTracingEnabled = TraceComponent.isAnyTracingEnabled();

        if (isTracingEnabled && tc.isEntryEnabled()) {
            Tr.entry(this, tc, "markLocalTransactionWrapperInUse");
        }

        if (state == STATE_ACTIVE_INUSE) {
            state = STATE_TRAN_WRAPPER_INUSE;
            tranWrapperInUse = LOCALTXWRAPPER;
            /*
             * If we are not in the shared pool we need to move the mcWrapper from
             * the unshared pool to the shared pool. Under normal conditions, this should not
             * be needed. The non-normal condition is when a user starts a user thread and
             * gets a connection then starts a transaction.
             */
            if (!(isInSharedPool() || this.getPoolState() == MCWrapper.ConnectionState_sharedTLSPool)) {
                if (cm.shareable()) {
                    pm.moveMCWrapperFromUnSharedToShared(this, uowCoord);
                }
            }
        } else { // state not STATE_ACTIVE_INUSE
            if (state != STATE_TRAN_WRAPPER_INUSE) {
                IllegalStateException e = new IllegalStateException("markLocalTransactionWrapperInUse: illegal state exception. State = " + getStateString() + " MCW = "
                                                                    + mcWrapperObject_hexString);
                Tr.error(tc, "ILLEGAL_STATE_EXCEPTION_J2CA0079", "markLocalTransactionWrapperInUse", e);
                throw e;
            } else { // state is STATE_TRAN_WRAPPER_INUSE
                if (tranWrapperInUse == NONE) {
                    tranWrapperInUse = LOCALTXWRAPPER;
                } else { //tranWrapperInUse is NOT NONE
                    if (tranWrapperInUse != LOCALTXWRAPPER) {
                        // Need RAS and Trace here.
                        IllegalStateException e = new IllegalStateException("markLocalTransactionWrapperInUse: illegal transaction state exception. State = "
                                                                            + getTranWrapperString());
                        Object[] parms = new Object[] { "markLocalTransactionWrapperInUse", e };
                        Tr.error(tc, "ILLEGAL_STATE_EXCEPTION_J2CA0079", parms);
                        throw e;
                    }
                }
            }
        }

        if (isTracingEnabled && tc.isEntryEnabled()) {
            Tr.exit(this, tc, "markLocalTransactionWrapperInUse");
        }

        return;

    }