Package com.atomikos.icatch

Examples of com.atomikos.icatch.CompositeTransaction


    {

        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 ) throw new IllegalStateException ("Thread already has subtx stack" );
View Full Code Here

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

        CompositeTransaction ct = null;
        ct = getCurrentTx ();
        if ( ct != null ) {
          if(LOGGER.isDebugEnabled()){
              LOGGER.logDebug("getCompositeTransaction()  returning instance with id "
                        + ct.getTid ());
          }
        } else{
          if(LOGGER.isDebugEnabled()){
            LOGGER.logDebug("getCompositeTransaction() returning NULL!");
          }
View Full Code Here

     */

    public CompositeTransaction getCompositeTransaction ( String tid )
            throws SysException
    {
        CompositeTransaction ret = service_.getCompositeTransaction ( tid );
        if ( ret != null ) {
          if(LOGGER.isDebugEnabled()){
            LOGGER.logDebug("getCompositeTransaction ( " + tid
                    + " ) returning instance with tid " + ret.getTid ());
          }
        } else {
          if(LOGGER.isDebugEnabled()){
            LOGGER.logDebug( "getCompositeTransaction ( " + tid
                    + " ) returning null");
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 ) {
            LOGGER.logWarning("Recreating a transaction with existing transaction: " + ct.getTid());
        }
        ct = service_.recreateCompositeTransaction ( context, orphancheck,
                heur_commit );
        Thread t = Thread.currentThread ();
        setThreadMappings ( ct, t );
View Full Code Here

    {
      if ( !initialized_ ) throw new IllegalStateException ( "Not initialized" );
      
     

        CompositeTransaction ret = getCurrentTx ();
        if ( ret != null ) {
          if(LOGGER.isInfoEnabled()){
            LOGGER.logInfo("suspend() for transaction " + ret.getTid ());
          }
          Thread thread = Thread.currentThread();  
            removeThreadMappings ( thread );
        } else {
          if(LOGGER.isInfoEnabled()){
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 );
        }
        while ( !tmp.isEmpty () ) {
View Full Code Here

     */

    public CompositeTransaction createCompositeTransaction ( long timeout ) throws SysException
    {
        Stack errors = new Stack();
        CompositeTransaction ct = null , ret = null;
       
        ct = getCurrentTx ();
        if ( ct == null ) {
            ret = service_.createCompositeTransaction ( timeout );
            if(LOGGER.isInfoEnabled()){
              LOGGER.logInfo("createCompositeTransaction ( " + timeout + " ): "
                    + "created new ROOT transaction with id " + ret.getTid ());
            }
        } else {
           if(LOGGER.isInfoEnabled()) LOGGER.logInfo("createCompositeTransaction ( " + timeout + " )");
            ret = ct.getTransactionControl ().createSubTransaction ();

        }
        Thread thread = Thread.currentThread ();
        setThreadMappings ( ret, thread );

View Full Code Here

    }

    protected CompositeTransaction createSubTransaction ()
            throws SysException, IllegalStateException
    {
        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

        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

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.