public SITransaction getCurrentTransaction() throws IllegalStateException,
            ResourceException, SIException, SIErrorException
    {

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.entry(this, TRACE, "getCurrentTransaction");
        }

        if (_sessionClosed) {
            throw new IllegalStateException(NLS.getFormattedMessage(
                    ("ILLEGAL_STATE_CWSJR1130"),
                    new Object[] { "getCurrentTransaction"}, null));
        }
        if (_sessionInvalidated) {
            throw new IllegalStateException(NLS.getFormattedMessage(
                    ("ILLEGAL_STATE_CWSJR1134"),
                    new Object[] { "getCurrentTransaction"}, null));
        }

        SITransaction transaction = null;

        if (_applicationLocalTransaction != null) {
            transaction = _applicationLocalTransaction;
        } else {

            if (!_connection.getConnectionFactory().isManaged()) {

                if (getTransacted()) {
                    _applicationLocalTransaction = _connection
                            .getSICoreConnection()
                            .createUncoordinatedTransaction();

                    // set rtn value..
                    transaction = _applicationLocalTransaction;
                }

            } else {

               transaction = getManagedConnection().getCurrentTransaction(
                            _connection.getConnectionManager());

                if ((transaction == null) && (getTransacted())) {

                    try {

                        _applicationLocalTransaction = _connection
                                .getSICoreConnection()
                                .createUncoordinatedTransaction();

                    } catch (final SIException exception) {

                        FFDCFilter.processException(exception, CLASS_NAME
                                + ".getCurrentTransaction", "1:306:1.47", this);
                        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEventEnabled()) {
                            SibTr.exception(this, TRACE, exception);
                        }
                        throw exception;

                    } catch (final SIErrorException exception) {

                        FFDCFilter.processException(exception, CLASS_NAME
                                + ".getCurrentTransaction", "1:315:1.47", this);
                        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEventEnabled()) {
                            SibTr.exception(this, TRACE, exception);
                        }
                        throw exception;

                    }

                    _managedConnection.localTransactionStarted();

                    // set rtn value..
                    transaction = _applicationLocalTransaction;
                }

            }
        }

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.exit(TRACE, "getCurrentTransaction", transaction);
        }
        return transaction;
    }
public SITransaction getCurrentTransaction ( ) throws IllegalStateException , ResourceException , SIException , SIErrorException { if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , "getCurrentTransaction" ) ; } if ( _sessionClosed ) { throw new IllegalStateException ( NLS . getFormattedMessage ( ( "ILLEGAL_STATE_CWSJR1130" ) , new Object [ ] { "getCurrentTransaction" } , null ) ) ; } if ( _sessionInvalidated ) { throw new IllegalStateException ( NLS . getFormattedMessage ( ( "ILLEGAL_STATE_CWSJR1134" ) , new Object [ ] { "getCurrentTransaction" } , null ) ) ; } SITransaction transaction = null ; if ( _applicationLocalTransaction != null ) { transaction = _applicationLocalTransaction ; } else { if ( ! _connection . getConnectionFactory ( ) . isManaged ( ) ) { if ( getTransacted ( ) ) { _applicationLocalTransaction = _connection . getSICoreConnection ( ) . createUncoordinatedTransaction ( ) ; transaction = _applicationLocalTransaction ; } } else { transaction = getManagedConnection ( ) . getCurrentTransaction ( _connection . getConnectionManager ( ) ) ; if ( ( transaction == null ) && ( getTransacted ( ) ) ) { try { _applicationLocalTransaction = _connection . getSICoreConnection ( ) . createUncoordinatedTransaction ( ) ; } catch ( final SIException exception ) { FFDCFilter . processException ( exception , CLASS_NAME + ".getCurrentTransaction" , "1:306:1.47" , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEventEnabled ( ) ) { SibTr . exception ( this , TRACE , exception ) ; } throw exception ; } catch ( final SIErrorException exception ) { FFDCFilter . processException ( exception , CLASS_NAME + ".getCurrentTransaction" , "1:315:1.47" , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEventEnabled ( ) ) { SibTr . exception ( this , TRACE , exception ) ; } throw exception ; } _managedConnection . localTransactionStarted ( ) ; transaction = _applicationLocalTransaction ; } } } if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( TRACE , "getCurrentTransaction" , transaction ) ; } return transaction ; }
Returns the current core transaction object for this session.
Re-associates with a managed connection if currently disassociated. If
there is currently an application local transaction associated with this
session then there cannot be a container transaction so this local
transaction is returned immediately. Otherwise, calls
<code>getCurrentTransaction</code> on the managed connection to obtain
the current container global or local transaction. If there is one, this
is returned to the caller. If <code>null</code> is returned and the
session is transacted then a local transaction is created on the
associated core connection, <code>localTransactionStarted</code> called
on the managed connection and the local transaction returned. Otherwise,
<code>null</code> is returned.

@return the current transaction, if any
@throws IllegalStateException
if this session has been closed or invalidated. This can also
be thrown if the connection is not associated with a managed
connection and the connection manager does not support lazy
enlistment
@throws ResourceException
if a lazy enlist was required and failed
@throws SIException
if the call resulted in a failed attempt to start a
transaction
@throws SIErrorException
if the call resulted in a failed attempt to start a
transaction