Examples of SubordinateTransaction


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

        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

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

   
    /*
     * Check to see if we haven't already imported this thing.
     */
   
    SubordinateTransaction imported = getImportedTransaction(xid);
   
    if (imported == null)
    { 
      imported = new TransactionImple(timeout, xid);
     
View Full Code Here

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

  public SubordinateTransaction getImportedTransaction (Xid xid) throws XAException
  {
    if (xid == null)
      throw new IllegalArgumentException();
   
    SubordinateTransaction tx = _transactions.get(new XidImple(xid));
   
    if (tx == null)
      return null;

    if (tx.baseXid() == null)
    {
      /*
       * Try recovery again. If it fails we'll throw a RETRY to the caller who
       * should try again later.
       */
            tx.recover();

      return tx;
    }
    else
      return tx;
View Full Code Here

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

  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
        throw new XAException(XAException.XA_RETRY);
View Full Code Here

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

  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)
    {
      throw new XAException(XAException.XAER_RMERR);
    }
View Full Code Here

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

  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);

        return XAResource.XA_RDONLY;
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.