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;

    }
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 ( ! ( isInSharedPool ( ) || this . getPoolState ( ) == MCWrapper . ConnectionState_sharedTLSPool ) ) { if ( cm . shareable ( ) ) { pm . moveMCWrapperFromUnSharedToShared ( this , uowCoord ) ; } } } else { 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 { if ( tranWrapperInUse == NONE ) { tranWrapperInUse = LOCALTXWRAPPER ; } else { if ( tranWrapperInUse != LOCALTXWRAPPER ) { 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 ; }
Called upon first use of the LocalTransactionWrapper, as determined by the wrapper itself,
this method is used to execute (and check) the appropriate state transitions.