Package com.atomikos.icatch

Examples of com.atomikos.icatch.CompositeTransaction


        return myException;
    }

    public void run ()
    {
        CompositeTransaction ct = null;
        try {
            ct = Configuration.getImportingTransactionManager ()
                    .importTransaction ( propagation, true, false );
            ct.getTransactionControl ().setTag ( msg );
            if ( propagation.isSerial () )
                myWaiter.getToken ();
            myCode.exec ();
            // delegates call to implementation

            ct.getTransactionControl ().getTerminator ().commit ();
        } catch ( Exception e ) {
            myWaiter.incAbortCount ();
            myException = e;
            ct.getTransactionControl ().getTerminator ().rollback ();
        } finally {
            if ( propagation.isSerial () )
                myWaiter.giveToken ();
            myWaiter.decActives ();
        }
View Full Code Here


     */

    public CompositeTransaction createSubTransaction () throws SysException,
            IllegalStateException
    {
        CompositeTransaction ret = localGetTransactionStateHandler().createSubTransaction ();
        printMsg ( "createSubTransaction(): created new SUBTRANSACTION "
                + ret.getTid () + " for existing transaction " + getTid (),
                Console.INFO );
        return ret;
    }
View Full Code Here

    {

        Stack ret = null;
        synchronized ( threadtotxmap_ ) {
            ret = (Stack) threadtotxmap_.remove ( thread );
            CompositeTransaction tx = (CompositeTransaction) ret.peek ();
            txtothreadmap_.remove ( tx );
        }
        return ret;
    }
View Full Code Here

    private void restoreThreadMappings ( Stack stack , Thread thread )
            throws IllegalStateException
    {
      //case 21806: callbacks to ct to be made outside synchronized block
      CompositeTransaction tx = (CompositeTransaction) stack.peek ();
      tx.addSubTxAwareParticipant ( this ); //step 1
     
        synchronized ( threadtotxmap_ ) {
          //between step 1 and here, intermediate timeout/rollback of the ct
          //may have happened; make sure to check or we add a thread mapping
          //that will never be removed!
          Object state = tx.getState();
         
          if ( TxState.ACTIVE.equals ( state ) || TxState.MARKED_ABORT.equals ( state ) ) {
            //also resume for marked abort - see case 26398
            Stack txs = (Stack) threadtotxmap_.get ( thread );
            if ( txs != null )
View Full Code Here

    public CompositeTransaction getCompositeTransaction () throws SysException
    {
        if ( !initialized_ )
            throw new IllegalStateException ( "Not initialized" );

        CompositeTransaction ct = null;
        ct = getCurrentTx ();
        if ( ct != null ) {
            printMsg ( "getCompositeTransaction()  returning instance with id "
                    + ct.getTid (), Console.DEBUG );
        } else
            printMsg ( "getCompositeTransaction() returning NULL!",
                    Console.DEBUG );
        return ct;
    }
View Full Code Here

     */

    public CompositeTransaction getCompositeTransaction ( String tid )
            throws SysException
    {
        CompositeTransaction ret = service_.getCompositeTransaction ( tid );
        if ( ret != null ) {
            printMsg ( "getCompositeTransaction ( " + tid
                    + " ) returning instance with tid " + ret.getTid (),
                    Console.DEBUG );
        } else {
            printMsg ( "getCompositeTransaction ( " + tid
                    + " ) returning NULL!", Console.DEBUG );
        }
View Full Code Here

    protected synchronized CompositeTransaction recreateCompositeTransaction (
            Propagation context , boolean orphancheck , boolean heur_commit )
            throws SysException
    {
        CompositeTransaction ct = null;
       
       
        ct = getCurrentTx();
        if ( ct != null ) {
            String msg = "Recreating a transaction with existing transaction: " + ct.getTid();
            printMsg ( msg , Console.WARN );
            //FOLLOWING DISABLED BECAUSE IT MAKES TESTS FAIL
            //throw new IllegalStateException ( msg );
        }
        ct = service_.recreateCompositeTransaction ( context, orphancheck,
View Full Code Here

        Thread thread = Thread.currentThread ();
        // Stack ret = null;
        if ( !initialized_ )
            throw new IllegalStateException ( "Not initialized" );

        CompositeTransaction ret = getCurrentTx ();
        if ( ret != null ) {
            printMsg ( "suspend() for transaction " + ret.getTid (),
                    Console.INFO );
            removeThreadMappings ( thread );
        } else {
            printMsg ( "suspend() called without a transaction context",
                    Console.INFO );
View Full Code Here

        Stack ancestors = new Stack ();
        Stack tmp = new Stack ();
        Stack lineage = (Stack) ct.getLineage ().clone ();
        boolean done = false;
        while ( !lineage.isEmpty () && !done ) {
            CompositeTransaction parent = (CompositeTransaction) lineage.pop ();
            if ( !parent.isLocal () )
                done = true;
            else
                tmp.push ( parent );
        }
        // now, reverse order of tmp
View Full Code Here

     */
   
    public CompositeTransaction createCompositeTransaction ( long timeout ) throws SysException
    {
        Stack errors = new Stack ();
        CompositeTransaction ct = null , ret = null;
        Thread thread = Thread.currentThread ();

        ct = getCurrentTx ();
        if ( ct == null ) {

            ret = service_.createCompositeTransaction ( timeout );
            printMsg ( "createCompositeTransaction ( " + timeout + " ): "
                    + "created new ROOT transaction with id " + ret.getTid (),
                    Console.INFO );
        } else {          
           
            printMsg ( "createCompositeTransaction ( " + timeout + " )",
                    Console.INFO );
            // let CT implementation do the details of logging
            ret = ct.getTransactionControl ().createSubTransaction ();

        }
        setThreadMappings ( ret, thread );

        return ret;
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.