Package org.mule.api.transaction

Examples of org.mule.api.transaction.TransactionException


            // Verify transaction has begun.
            Transaction currentTx = context.getCurrentTransaction();
            if (currentTx == null || !currentTx.isBegun())
            {   
                context.setStopFurtherProcessing(true);
                throw new TransactionException(MessageFactory.createStaticMessage("Trying to roll back transaction but no transaction is underway."));
            }           

            if (rollback)
            {
                // Mark the transaction for rollback.
View Full Code Here


                con.setAutoCommit(false);
            }
        }
        catch (SQLException e)
        {
            throw new TransactionException(DbMessages.transactionSetAutoCommitFailed(), e);
        }
        super.bindResource(key, resource);
    }
View Full Code Here

        {
            logger.warn(CoreMessages.commitTxButNoResource(this));
            return;
        }

        TransactionException transactionException = null;
        try
        {
            ((Connection) resource).commit();
        }
        catch (SQLException e)
        {
            transactionException = new TransactionException(CoreMessages.transactionCommitFailed(), e);
        }
        finally
        {
            closeConnection(transactionException);
        }
View Full Code Here

        {
            logger.warn(CoreMessages.rollbackTxButNoResource(this));
            return;
        }

        TransactionException transactionException = null;
        try
        {
            ((Connection) resource).rollback();
        }
        catch (SQLException e)
View Full Code Here

        }
        catch (SQLException e)
        {
            if (transactionException == null)
            {
                transactionException = new TransactionException(CoreMessages.createStaticMessage("Cannot close connection."), e);
            }
            else
            {
                logger.info("Cannot close connection.");
            }
View Full Code Here

        {
            ((Session) resource).commit();
        }
        catch (JMSException e)
        {
            throw new TransactionException(CoreMessages.transactionCommitFailed(), e);
        }
        finally
        {
            try
            {
View Full Code Here

            }
            ((Session) resource).rollback();
        }
        catch (JMSException e)
        {
            throw new TransactionException(CoreMessages.transactionRollbackFailed(), e);
        }
        finally
        {
            try
            {
View Full Code Here

    @Override
    public void bindResource(Object key, Object resource) throws TransactionException
    {
        if (!(this.delegate instanceof NullTransaction))
        {
            throw new TransactionException(CoreMessages.createStaticMessage("Single resource transaction has already a resource bound"));
        }
        TransactionFactory transactionFactory = muleContext.getTransactionFactoryManager().getTransactionFactoryFor(key.getClass());
        this.unbindTransaction();
        this.delegate = transactionFactory.beginTransaction(muleContext);
        delegate.bindResource(key, resource);
View Full Code Here

    @Test
    public void testCommitDoesntFailOnException() throws Exception
    {
        assertThat(tc.getTransaction(), IsNull.<Object>nullValue());
        Transaction tx = mock(Transaction.class);
        doThrow(new TransactionException((Throwable) null)).when(tx).commit();
        TransactionCoordination.getInstance().commitCurrentTransaction();
    }
View Full Code Here

    @Test
    public void testRollbackDoesntFailOnException() throws Exception
    {
        assertThat(tc.getTransaction(), IsNull.<Object>nullValue());
        Transaction tx = mock(Transaction.class);
        doThrow(new TransactionException((Throwable) null)).when(tx).rollback();
        TransactionCoordination.getInstance().rollbackCurrentTransaction();
    }
View Full Code Here

TOP

Related Classes of org.mule.api.transaction.TransactionException

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.