Package com.arjuna.ats.internal.jta.transaction.arjunacore.jca

Examples of com.arjuna.ats.internal.jta.transaction.arjunacore.jca.SubordinateTransaction


        assertEquals(javax.transaction.Status.STATUS_COMMITTED, t.getStatus());
    }

    public void testTwoPhaseCommitSyncWithRollbackOnly() throws Exception
    {
        final SubordinateTransaction tm = createTransaction();
        final TestSynchronization sync = new TestSynchronization();
        tm.registerSynchronization(sync);
        tm.setRollbackOnly();
        assertEquals(TwoPhaseOutcome.PREPARE_NOTOK, tm.doPrepare());
        tm.doRollback();
        assertFalse(sync.isBeforeCompletionDone());
        assertTrue(sync.isAfterCompletionDone());
        assertEquals(javax.transaction.Status.STATUS_ROLLEDBACK, tm.getStatus());
    }
View Full Code Here


    public void commit (Xid xid, boolean onePhase) throws XAException
    {
        try
        {
            SubordinateTransaction tx = SubordinationManager
                    .getTransactionImporter().getImportedTransaction(xid);

            if (tx == null)
                throw new XAException(XAException.XAER_INVAL);

            if (tx.baseXid() != null) // activate failed?
            {
                if (onePhase)
                    tx.doOnePhaseCommit();
                else
                    tx.doCommit();

                SubordinationManager.getTransactionImporter()
                        .removeImportedTransaction(xid);
            }
            else
View Full Code Here

    public void forget (Xid xid) throws XAException
    {
        try
        {
            SubordinateTransaction tx = SubordinationManager
                    .getTransactionImporter().getImportedTransaction(xid);

            if (tx == null)
                throw new XAException(XAException.XAER_INVAL);

            tx.doForget();
        }
        catch (Exception ex)
        {
            XAException xaException = new XAException(XAException.XAER_RMERR);
            xaException.initCause(ex);
View Full Code Here

    public int prepare (Xid xid) throws XAException
    {
        try
        {
            SubordinateTransaction tx = SubordinationManager
                    .getTransactionImporter().getImportedTransaction(xid);

            if (tx == null)
                throw new XAException(XAException.XAER_INVAL);

            switch (tx.doPrepare())
            {
            case TwoPhaseOutcome.PREPARE_READONLY:
                SubordinationManager.getTransactionImporter()
                        .removeImportedTransaction(xid);
View Full Code Here

    public void rollback (Xid xid) throws XAException
    {
        try
        {
            SubordinateTransaction tx = SubordinationManager
                    .getTransactionImporter().getImportedTransaction(xid);

            if (tx == null)
                throw new XAException(XAException.XAER_INVAL);

            if (tx.baseXid() != null)
            {
                tx.doRollback();

                SubordinationManager.getTransactionImporter()
                        .removeImportedTransaction(xid);
            }
            else
View Full Code Here

    public boolean beforeCompletion (Xid xid) throws javax.transaction.SystemException
    {
        try
        {
            SubordinateTransaction tx = SubordinationManager
                    .getTransactionImporter().getImportedTransaction(xid);

            if (tx == null)
                throw new UnexpectedConditionException();

           return tx.doBeforeCompletion();
        }
        catch (final Exception ex)
        {
            UnexpectedConditionException e = new UnexpectedConditionException();
           
View Full Code Here

        // now commit
        final Xid xid = this.xidTransactionID.getXid();
        // Courtesy: com.arjuna.ats.internal.jta.transaction.arjunacore.jca.XATerminatorImple
        try {
            // get the subordinate tx
            final SubordinateTransaction subordinateTransaction = SubordinationManager.getTransactionImporter().getImportedTransaction(xid);

            if (subordinateTransaction == null) {
                throw new XAException(XAException.XAER_INVAL);
            }

            if (subordinateTransaction.activated()) {
                if (this.onePhaseCommit) {
                    subordinateTransaction.doOnePhaseCommit();
                } else {
                    subordinateTransaction.doCommit();
                }
                // remove the tx
                SubordinationManager.getTransactionImporter().removeImportedTransaction(xid);
            } else {
                throw new XAException(XAException.XA_RETRY);
View Full Code Here

        this.resumeTransaction(transaction);
        // now rollback
        final Xid xid = this.xidTransactionID.getXid();
        // Courtesy: com.arjuna.ats.internal.jta.transaction.arjunacore.jca.XATerminatorImple
        try {
            SubordinateTransaction subordinateTransaction = SubordinationManager.getTransactionImporter().getImportedTransaction(xid);

            if (subordinateTransaction == null) {
                throw new XAException(XAException.XAER_INVAL);
            }

            if (subordinateTransaction.activated()) {
                subordinateTransaction.doRollback();
                // remove the imported tx
                SubordinationManager.getTransactionImporter().removeImportedTransaction(xid);
            } else {
                throw new XAException(XAException.XA_RETRY);
            }
View Full Code Here

        // "forget"
        final Xid xid = this.xidTransactionID.getXid();
        try {
            // get the subordinate tx
            final SubordinateTransaction subordinateTransaction = SubordinationManager.getTransactionImporter().getImportedTransaction(xid);

            if (subordinateTransaction == null) {
                throw new XAException(XAException.XAER_INVAL);
            }
            // invoke forget
            subordinateTransaction.doForget();

        } catch (Exception ex) {
            final XAException xaException = new XAException(XAException.XAER_RMERR);
            xaException.initCause(ex);
            throw xaException;
View Full Code Here

        this.resumeTransaction(transaction);
        try {
            // invoke the beforeCompletion
            final Xid xid = this.xidTransactionID.getXid();
            // Courtesy: com.arjuna.ats.internal.jta.transaction.arjunacore.jca.XATerminatorImple
            final SubordinateTransaction subordinateTransaction = SubordinationManager.getTransactionImporter().getImportedTransaction(xid);
            if (subordinateTransaction == null) {
                throw EjbMessages.MESSAGES.noSubordinateTransactionPresentForXid(xid);
            }
            // do beforeCompletion()
            subordinateTransaction.doBeforeCompletion();
        } finally {
            // disassociate the tx that was associated (resumed) on this thread.
            // This needs to be done explicitly because the SubOrdinationManager isn't responsible
            // for clearing the tx context from the thread
            this.transactionsRepository.getTransactionManager().suspend();
View Full Code Here

TOP

Related Classes of com.arjuna.ats.internal.jta.transaction.arjunacore.jca.SubordinateTransaction

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.