Examples of SubordinateTransaction


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

        }
    }


    private int prepareTransaction() throws Throwable {
        final SubordinateTransaction subordinateTransaction = this.transactionsRepository.getImportedTransaction(this.xidTransactionID);
        if (subordinateTransaction == null) {
            if (EjbLogger.EJB3_INVOCATION_LOGGER.isDebugEnabled()) {
                //this happens if no ejb invocations where made within the TX
                EjbLogger.EJB3_INVOCATION_LOGGER.debug("Not preparing transaction " + this.xidTransactionID + " as is was not found on the server");
            }
            return XAResource.XA_OK;
        }
        // first associate the tx on this thread, by resuming the tx
        this.resumeTransaction(subordinateTransaction);
        try {
            // now "prepare"
            // Courtesy: com.arjuna.ats.internal.jta.transaction.arjunacore.jca.XATerminatorImple
            int result = subordinateTransaction.doPrepare();
            switch (result) {
                case TwoPhaseOutcome.PREPARE_READONLY:
                    // TODO: Would it be fine to not remove the xid? (Need to understand how the subsequent
                    // flow works)
                    SubordinationManager.getTransactionImporter().removeImportedTransaction(this.xidTransactionID.getXid());
                    return XAResource.XA_RDONLY;

                case TwoPhaseOutcome.PREPARE_OK:
                    return XAResource.XA_OK;

                case TwoPhaseOutcome.PREPARE_NOTOK:
                    // the JCA API spec limits what we can do in terms of reporting
                    // problems.
                    // try to use the exception code and cause to provide info
                    // whilst
                    // remaining API compliant. JBTM-427.
                    Exception initCause = null;
                    int xaExceptionCode = XAException.XA_RBROLLBACK;
                    try {
                        subordinateTransaction.doRollback();
                    } catch (HeuristicCommitException e) {
                        initCause = e;
                        xaExceptionCode = XAException.XAER_RMERR;
                    } catch (HeuristicMixedException e) {
                        initCause = e;
View Full Code Here

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

        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

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

        // "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

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

        super(txRequestHandler, transactionsRepository, marshallerFactory, xidTransactionID, channelAssociation, invocationId);
    }

    @Override
    protected void manageTransaction() throws Throwable {
        final SubordinateTransaction subordinateTransaction = this.transactionsRepository.getImportedTransaction(this.xidTransactionID);
        if (subordinateTransaction == null) {
            throw EjbMessages.MESSAGES.noSubordinateTransactionPresentForXid(this.xidTransactionID.getXid());
        }
        // first associate the tx on this thread, by resuming the tx
        this.resumeTransaction(subordinateTransaction);
        try {
            // invoke the beforeCompletion
            // Courtesy: com.arjuna.ats.internal.jta.transaction.arjunacore.jca.XATerminatorImple
            // 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

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

        // 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

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

        // 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()) {
                // We have a bug in JBoss TS. Till that is fixed, we need this call.
                // See the comments on the hackJTS method for more details
                this.hackJTS(subordinateTransaction);

                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

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

        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

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

        // "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

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

        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 new RuntimeException("No subordinate transaction present with xid " + xid);
            }
            // do beforeCompletion()
            subordinateTransaction.doBeforeCompletion();
        } finally {
            // disassociate the tx that was asssociated (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

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

        this.resumeTransaction(transaction);
        try {
            // now "prepare"
            final Xid xid = this.xidTransactionID.getXid();
            // Courtesy: com.arjuna.ats.internal.jta.transaction.arjunacore.jca.XATerminatorImple
            final SubordinateTransaction subordinateTransaction = SubordinationManager.getTransactionImporter().getImportedTransaction(xid);
            int result = subordinateTransaction.doPrepare();
            switch (result) {
                case TwoPhaseOutcome.PREPARE_READONLY:
                    // TODO: Would it be fine to not remove the xid? (Need to understand how the subsequent
                    // flow works)
                    SubordinationManager.getTransactionImporter().removeImportedTransaction(xid);
                    return XAResource.XA_RDONLY;

                case TwoPhaseOutcome.PREPARE_OK:
                    return XAResource.XA_OK;

                case TwoPhaseOutcome.PREPARE_NOTOK:
                    // the JCA API spec limits what we can do in terms of reporting
                    // problems.
                    // try to use the exception code and cause to provide info
                    // whilst
                    // remaining API compliant. JBTM-427.
                    Exception initCause = null;
                    int xaExceptionCode = XAException.XA_RBROLLBACK;
                    try {
                        subordinateTransaction.doRollback();
                    } catch (HeuristicCommitException e) {
                        initCause = e;
                        xaExceptionCode = XAException.XAER_RMERR;
                    } catch (HeuristicMixedException e) {
                        initCause = e;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.