Package com.atomikos.icatch

Examples of com.atomikos.icatch.CompositeTransaction


    protected CompositeTransaction createSubTransaction ()
            throws SysException, IllegalStateException
    {
        // argument is not null on test!
        CompositeTransaction ct = null;
        ct = ct_.getTransactionService ().createSubTransaction ( ct_ );
        // we want to be notified of subtx commit for handling extents
        ct.addSubTxAwareParticipant ( this );
        localIncSubTxCount();
        return ct;
    }
View Full Code Here


            boolean serial , RecoveryCoordinator adaptor , Boolean isRecoverableWhileActive )
    {
        super ( tid , (Stack) lineage.clone () , serial  );
        adaptor_ = adaptor;
        Stack tmp = (Stack) lineage.clone ();
        CompositeTransaction parent = null;
        while ( !tmp.empty () ) {
            parent = (CompositeTransaction) tmp.pop ();
        }
        root_ = parent.getTid ();
        isRecoverableWhileActive_ = isRecoverableWhileActive;
    }
View Full Code Here

     */

    public CompositeTransaction importTransaction ( Propagation propagation ,
            boolean orphancheck , boolean heur_commit ) throws SysException
    {
        CompositeTransaction ret = ts_.recreateCompositeTransaction (
                propagation, orphancheck, heur_commit );
        // CompositeTransactionManager ctm =
        // Configuration.getCompositeTransactionManager();
        // ctm.resume ( ret );
        return ret;
View Full Code Here

    public Propagation getPropagation () throws SysException
    {
        PropagationImp ret = null;

        CompositeTransaction ct = Configuration
                .getCompositeTransactionManager ().getCompositeTransaction ();
        Stack lineage = (Stack) ct.getLineage ().clone ();
        lineage.push ( ct );
        ret = new PropagationImp ( lineage, ct.isSerial (), ct
                .getTransactionControl ().getTimeout () );

        return ret;
    }
View Full Code Here

        }
    }

    private CompositeTransaction getCompositeTransaction() throws ExtendedSystemException
    {
      CompositeTransaction ct = null;
       try {
             ct = ctm_.getCompositeTransaction ();
         } catch ( SysException se ) {
           String msg = "Error while retrieving the transaction for the calling thread";
           Configuration.logWarning( msg , se);
View Full Code Here

    public void begin ( int timeout ) throws NotSupportedException,
            SystemException
    {
        TransactionImp tx = null;
        CompositeTransaction ct = null;
        ResumePreviousTransactionSubTxAwareParticipant resumeParticipant = null;
       
        ct = ctm_.getCompositeTransaction();
        if ( ct != null && ct.getProperty JTA_PROPERTY_NAME ) == null ) {
            Configuration.logWarning ( "JTA: temporarily suspending incompatible transaction: " + ct.getTid() +
                    " (will be resumed after JTA transaction ends)" );
            ct = ctm_.suspend();
            resumeParticipant = new ResumePreviousTransactionSubTxAwareParticipant ( ct );
        }
       
        try {
            ct = ctm_.createCompositeTransaction ( ( ( long ) timeout ) * 1000 );
            if ( resumeParticipant != null ) ct.addSubTxAwareParticipant ( resumeParticipant );
            if ( ct.isRoot () && getDefaultSerial () )
                ct.getTransactionControl ().setSerial ();
            ct.setProperty ( JTA_PROPERTY_NAME , "true" );
        } catch ( SysException se ) {
          String msg = "Error in begin()";
          Configuration.logWarning( msg , se );
            throw new ExtendedSystemException ( msg , se
                    .getErrors () );
        }
        // a new tx can not be in the map yet.
        // next, we put it there.
        tx = new TransactionImp ( ct, automaticResourceRegistration_ );
        addToMap ( ct.getTid (), tx );
        ct.addSubTxAwareParticipant ( this );
    }
View Full Code Here

    public Transaction getTransaction () throws SystemException
    {

        TransactionImp ret = null;
        CompositeTransaction ct = null;
        ct = getCompositeTransaction();

        if ( ct == null || ct.getProperty JTA_PROPERTY_NAME ) == null ) // no tx for thread yet
            ret = null;
        else {
            // since tx was created by begin(), it should be in map
            // note: only active txs are relevant, since setRollbackOnly
            // may have been called already
            ret = getPreviousInstance ( ct.getTid () );
            if ( ret == null && ct.getState ().equals ( TxState.ACTIVE ) ) {
                // happens for JTS imported txs
                ret = new TransactionImp ( ct, automaticResourceRegistration_ );
                addToMap ( ct.getTid (), ret );
                ct.addSubTxAwareParticipant ( this );
            }

        }
        return ret;
    }
View Full Code Here

    {
        // make sure imported txs can be suspended...
        getTransaction ();

        TransactionImp ret = null;
        CompositeTransaction ct = null;
        try {
            ct = ctm_.suspend ();
        } catch ( SysException se ) {
          String msg = "Unexpected error while suspending the existing transaction for the current thread";
          Configuration.logWarning( msg , se );
            throw new ExtendedSystemException ( msg , se
                    .getErrors () );
        }
        if ( ct != null ) {

            ret = getPreviousInstance ( ct.getTid () );
            if ( ret != null ) {
              // cf case 61305: suspend any enlisted XAResource instances
              ret.suspendEnlistedXaResources();
            }
        }
View Full Code Here

        // make sure imported txs can be supported...
        getTransaction ();

        TransactionImp tx = null;
        CompositeTransaction ct = getCompositeTransaction();

        if ( ct == null ) // no tx for thread yet
            ret = Status.STATUS_NO_TRANSACTION;
        else {
            tx = getPreviousInstance ( ct.getTid () );
            ret = tx.getStatus ();
        }

        return ret;
    }
View Full Code Here

            javax.transaction.HeuristicRollbackException,
            javax.transaction.SystemException, java.lang.IllegalStateException,
            java.lang.SecurityException
    {
        TransactionImp tx = null;
        CompositeTransaction ct = null;

        // make sure imported txs can be supported...
        getTransaction ();

        ct = getCompositeTransaction();

        if ( ct == null ) // no tx for thread yet
            raiseNoTransaction();
        else {
            tx = getPreviousInstance ( ct.getTid () );
            tx.commit ();
        }
    }
View Full Code Here

TOP

Related Classes of com.atomikos.icatch.CompositeTransaction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.