Examples of TxInfo


Examples of com.arjuna.ats.internal.jta.xa.TxInfo

       * with it. Each element on this list also contains a list of
       * threads which have registered this resource, and what their XID
       * was for that registration.
       */

      TxInfo info = null;

      /*
       * Have we seen this specific resource instance before? Do this
       * trawl first before checking the RM instance later. Saves time.
       */

      try
      {
        synchronized (this)
        {
          info = (TxInfo) _resources.get(xaRes);

          if (info == null)
          {
            /*
             * Null info means it's not in the main resources list,
             * but may be in the duplicates.
             */

            info = (TxInfo) _duplicateResources.get(xaRes);
          }
        }

        if (info != null)
        {
          switch (info.getState())
          {
          case TxInfo.ASSOCIATION_SUSPENDED:
          {
            /*
             * Have seen resource before, so do a resume. The
             * Resource instance will still be registered with the
             * transaction though.
             */

            int xaStartResume = ((theModifier == null) ? XAResource.TMRESUME
                : theModifier
                    .xaStartParameters(XAResource.TMRESUME));

            xaRes.start(info.xid(), xaStartResume);

            info.setState(TxInfo.ASSOCIATED);

            synchronized (this)
            {
              _suspendCount--;
            }

            return true; // already registered resource with this
            // transaction!
          }
          case TxInfo.ASSOCIATED:
          {
            /*
             * Already active on this transaction.
             */

            return true;
          }
          case TxInfo.NOT_ASSOCIATED:
          {
            /*
             * Resource was associated, but was presumably delisted.
             */

            int xaStartJoin = ((theModifier == null) ? XAResource.TMJOIN
                : theModifier
                    .xaStartParameters(XAResource.TMJOIN));

            xaRes.start(info.xid(), xaStartJoin);

            info.setState(TxInfo.ASSOCIATED);

            return true;
          }
          default:
          {
            // Note: this exception will be caught by our catch
            // block

            throw new IllegalStateException(
                "TransactionImple.enlistResource - "
                    + jtaLogger.logMesg
                        .getString("com.arjuna.ats.internal.jta.transaction.arjunacore.illresstate")
                    + ":" + info.getState());
          }
          }
        }
      }
      catch (IllegalStateException ex)
      {
        throw ex; // we threw it in the first place
      }
      catch (XAException exp)
      {
        if (info != null)
          info.setState(TxInfo.FAILED);

        if (jtaLogger.loggerI18N.isWarnEnabled())
        {
          jtaLogger.loggerI18N
              .warn(
                  "com.arjuna.ats.internal.jta.transaction.arjunacore.enlisterror",
                  new Object[]
                  { "TransactionImple.enlistResource",
                      XAHelper.printXAErrorCode(exp) });
        }

        return false;
      }

      // if (threadIsActive(xaRes))
      // return true; // this thread has already registered a resource for
      // this db

      /*
       * We definitely haven't seen this specific resource instance
       * before, but that doesn't mean that we haven't seen the RM it is
       * connected to.
       */

      Xid xid = null;
      TxInfo existingRM = isNewRM(xaRes);

      if (existingRM == null)
      {
        /*
         * New RM, so create xid with new branch.
         */

        boolean branchRequired = true;

        synchronized (this)
        {
          if (_resources.size() == 0)// first ever, so no need for
          // branch
          {
            // branchRequired = false;
            branchRequired = true;
          }
        }

        xid = createXid(branchRequired, theModifier);

        boolean associatedWork = false;
        int retry = 20;

        /*
         * If another process has (or is about to) create the same
         * transaction association then we will probably get a failure
         * during start with XAER_DUPID. We know this must be due to
         * another server, since we keep track of our own registrations.
         * So, if this happens we create a new transaction branch and
         * try again.
         *
         * To save time we could always just create branches by default.
         *
         * Is there a benefit to a zero branch?
         */

        while (!associatedWork)
        {
          try
          {
            if (_xaTransactionTimeoutEnabled)
            {
              int timeout = _theTransaction.getTimeout();

              if (timeout > 0)
              {
                try
                {
                  xaRes.setTransactionTimeout(timeout);
                }
                catch (XAException te)
                {
                  if (jtaLogger.loggerI18N.isWarnEnabled())
                  {
                    jtaLogger.loggerI18N
                        .warn(
                            "com.arjuna.ats.internal.jta.transaction.arjunacore.timeouterror",
                            new Object[]
                            {
                                "TransactionImple.enlistResource",
                                XAHelper
                                    .printXAErrorCode(te),
                                xid }, te);
                  }
                }
              }
            }

            int xaStartNormal = ((theModifier == null) ? XAResource.TMNOFLAGS
                : theModifier
                    .xaStartParameters(XAResource.TMNOFLAGS));


                        // Pay attention now, this bit is hairy. We need to add a new AbstractRecord (XAResourceRecord)
                        // to the BasicAction, which will thereafter drive its completion. However, the transaction
                        // core is not directly XA aware, so it's our job to start the XAResource. Problem is, if
                        // adding the record fails, BasicAction will never end the resource via the XAResourceRecord,
                        // so we must do so directly.  start may fail due to dupl xid or other reason, and transactions
                        // may rollback async, for which reasons we can't call add before start.
                        // The xid will change on each pass of the loop, so we need to create a new record on each pass.
                        // The creation will fail in the case of multiple last resources being disallowed, in which
                        // case we don't call start on the resource at all. see JBTM-362 and JBTM-363
                        AbstractRecord abstractRecord = createRecord(xaRes, params, xid);
                        if(abstractRecord != null) {
                            xaRes.start(xid, xaStartNormal);
                            if(_theTransaction.add(abstractRecord) == AddOutcome.AR_ADDED) {
                                _resources.put(xaRes, new TxInfo(xid));
                                return true; // dive out, no need to set associatedWork = true;
                            } else {
                                // we called start on the resource, but _theTransaction did not accept it.
                                // we therefore have a mess which we must now clean up by ensuring the start is undone:
                                abstractRecord.topLevelAbort();
                            }
                        }

                        // if we get to here, something other than a failure of xaRes.start probably went wrong.
                        // so we don't loop and retry, we just give up.
                        markRollbackOnly();
                        return false;

          }
          catch (XAException e)
          {
            // transaction already created by another server

            if ((e.errorCode == XAException.XAER_DUPID)
                || (e.errorCode == XAException.XAER_RMERR))
            {
              if (retry > 0)
                xid = createXid(true, theModifier);

              retry--;
            }
            else
            {
              /*
               * Can't do start, so set transaction to rollback
               * only.
               */

              if (jtaLogger.loggerI18N.isWarnEnabled())
              {
                jtaLogger.loggerI18N
                    .warn(
                        "com.arjuna.ats.internal.jta.transaction.arjunacore.enliststarterror",
                        new Object[]
                        {
                            "TransactionImple.enlistResource",
                            XAHelper
                                .printXAErrorCode(e),
                            xid });
              }

              markRollbackOnly();

              throw e;
            }

            if (retry < 0)
            {
              if (jtaLogger.loggerI18N.isWarnEnabled())
              {
                jtaLogger.loggerI18N
                    .warn(
                        "com.arjuna.ats.internal.jta.transaction.arjunacore.enliststarterror",
                        new Object[]
                        {
                            "TransactionImple.enlistResource",
                            XAHelper
                                .printXAErrorCode(e),
                            xid });
              }

              markRollbackOnly();

              throw new javax.transaction.SystemException(
                  "TransactionImple.enlistResource - XAResource.start "
                      + jtaLogger.logMesg
                          .getString("com.arjuna.ats.internal.jta.transaction.arjunacore.couldnotregister")
                      + ": " + xid);
            }
          }
        }
      }
      else
      {
        /*
         * Have seen this RM before, so ignore this instance. The first
         * registered RM instance will be used to drive the transaction
         * completion. We add it to the duplicateResource list so we can
         * delist it correctly later though.
         */

        /*
         * Re-create xid.
         */

        xid = existingRM.xid();

        try
        {
          int xaStartJoin = ((theModifier == null) ? XAResource.TMJOIN
              : theModifier.xaStartParameters(XAResource.TMJOIN));

          xaRes.start(xid, xaStartJoin);
        }
        catch (XAException ex)
        {
          if (jtaLogger.loggerI18N.isWarnEnabled())
          {
            jtaLogger.loggerI18N
                .warn(
                    "com.arjuna.ats.internal.jta.transaction.arjunacore.xastart",
                    new Object[]
                    {
                        "TransactionImple.enlistResource - xa_start ",
                        XAHelper.printXAErrorCode(ex),
                        xid });
          }

          markRollbackOnly();

          throw ex;
        }

        /*
         * Add to duplicate resources list so we can keep track of it
         * (particularly if we later have to delist).
         */

        _duplicateResources.put(xaRes, new TxInfo(xid));

        return true;
      }

            return false;
View Full Code Here

Examples of com.arjuna.ats.internal.jta.xa.TxInfo

      throw new IllegalStateException(
          jtaLogger.logMesg
              .getString("com.arjuna.ats.internal.jta.transaction.arjunacore.inactive"));
    }

    TxInfo info = null;

    try
    {
      synchronized (this)
      {
        info = (TxInfo) _resources.get(xaRes);

        if (info == null)
          info = (TxInfo) _duplicateResources.get(xaRes);
      }

      if (info == null)
      {
        if (jtaLogger.loggerI18N.isWarnEnabled())
        {
          jtaLogger.loggerI18N
              .warn(
                  "com.arjuna.ats.internal.jta.transaction.arjunacore.unknownresource",
                  new Object[]
                  { "TransactionImple.delistResource" });
        }

        return false;
      }
      else
      {
        boolean optimizedRollback = false;

        try
        {
          /*
           * If we know the transaction is going to rollback, then we
           * can try to rollback the RM now. Just an optimisation.
           */

          if (status == javax.transaction.Status.STATUS_MARKED_ROLLBACK)
          {
            if (XAUtils.canOptimizeDelist(xaRes))
            {
              xaRes.end(info.xid(), XAResource.TMFAIL);
              xaRes.rollback(info.xid());

              info.setState(TxInfo.OPTIMIZED_ROLLBACK);

              optimizedRollback = true;
            }
          }
        }
        catch (Exception e)
        {
          // failed, so try again when transaction does rollback
        }

        switch (info.getState())
        {
        case TxInfo.ASSOCIATED:
        {
          if ((flags & XAResource.TMSUCCESS) != 0)
          {
            xaRes.end(info.xid(), XAResource.TMSUCCESS);
            info.setState(TxInfo.NOT_ASSOCIATED);
          }
          else
          {
            if ((flags & XAResource.TMSUSPEND) != 0)
            {
              xaRes.end(info.xid(), XAResource.TMSUSPEND);
              info.setState(TxInfo.ASSOCIATION_SUSPENDED);

              synchronized (this)
              {
                _suspendCount++;
              }
            }
            else
            {
              xaRes.end(info.xid(), XAResource.TMFAIL);
              info.setState(TxInfo.FAILED);
            }
          }
        }
          break;
        case TxInfo.ASSOCIATION_SUSPENDED:
        {
          if ((flags & XAResource.TMSUCCESS) != 0)
          {
            // Oracle barfs if we don't send resume first, despite
            // what XA says!

            if (XAUtils.mustEndSuspendedRMs(xaRes))
              xaRes.start(info.xid(), XAResource.TMRESUME);

            xaRes.end(info.xid(), XAResource.TMSUCCESS);
            info.setState(TxInfo.NOT_ASSOCIATED);

            synchronized (this)
            {
              _suspendCount--;
            }
          }
          else
          {
            if ((flags & XAResource.TMSUSPEND) != 0)
            {
              // Note: this exception will be caught by our catch
              // block

              throw new IllegalStateException(
                  "TransactionImple.delistResource - "
                      + jtaLogger.logMesg
                          .getString("com.arjuna.ats.internal.jta.transaction.arjunacore.ressuspended"));
            }
            else
            {
              xaRes.end(info.xid(), XAResource.TMFAIL);
              info.setState(TxInfo.FAILED);

              synchronized (this)
              {
                _suspendCount--;
              }
            }
          }
        }
          break;
        default:
        {
          if (!optimizedRollback)
            throw new IllegalStateException(
                "TransactionImple.delistResource - "
                    + jtaLogger.logMesg
                        .getString("com.arjuna.ats.internal.jta.transaction.arjunacore.illresstate")
                    + ":" + info.getState());
        }
        }

        info = null;

        return true;
      }
    }
    catch (IllegalStateException ex)
    {
      throw ex;
    }
    catch (XAException exp)
    {
      if (info != null)
        info.setState(TxInfo.FAILED);

      /*
       * For safety mark the transaction as rollback only.
       */

 
View Full Code Here

Examples of com.arjuna.ats.internal.jta.xa.TxInfo

  {
    int state = TxInfo.UNKNOWN;

    if (xaRes != null)
    {
      TxInfo info = (TxInfo) _resources.get(xaRes);

      if (info == null)
      {
        info = (TxInfo) _duplicateResources.get(xaRes);
      }

      if (info != null)
        state = info.getState();
    }

    return state;
  }
View Full Code Here

Examples of com.arjuna.ats.internal.jta.xa.TxInfo

            /*
             * Get the XAResource in case we have to call end on it.
             */

            XAResource xaRes = (XAResource) el.nextElement();
            TxInfo info = (TxInfo) _resources.get(xaRes);

            if (info.getState() == TxInfo.ASSOCIATION_SUSPENDED)
            {
              if (XAUtils.mustEndSuspendedRMs(xaRes))
                xaRes.start(info.xid(), XAResource.TMRESUME);

              xaRes.end(info.xid(), XAResource.TMSUCCESS);
              info.setState(TxInfo.NOT_ASSOCIATED);
            }
          }
        }
        catch (XAException ex)
        {
          if (jtaLogger.loggerI18N.isWarnEnabled())
          {
            jtaLogger.loggerI18N
                .warn("com.arjuna.ats.internal.jta.transaction.arjunacore.xaenderror");
          }

          result = false;
        }
      }

      /*
       * need to do the same for all duplicated resources
       */

      el = _duplicateResources.keys();

      if (el != null)
      {
        try
        {
          /*
           * Would it gain us much to just loop for _suspendCount?
           */

          while (el.hasMoreElements())
          {
            /*
             * Get the XAResource in case we have to call end on it.
             */

            XAResource xaRes = (XAResource) el.nextElement();
            TxInfo info = (TxInfo) _duplicateResources.get(xaRes);

            if (info.getState() == TxInfo.ASSOCIATION_SUSPENDED)
            {
              if (XAUtils.mustEndSuspendedRMs(xaRes))
                xaRes.start(info.xid(), XAResource.TMRESUME);

              xaRes.end(info.xid(), XAResource.TMSUCCESS);
              info.setState(TxInfo.NOT_ASSOCIATED);
            }
          }
        }
        catch (XAException ex)
        {
View Full Code Here

Examples of com.arjuna.ats.internal.jta.xa.TxInfo

        {
          XAResource x = (XAResource) el.nextElement();

          if (x.isSameRM(xaRes))
          {
            TxInfo info = (TxInfo) _resources.get(x);

            if (info.thread() == t)
              return true;
          }
        }
      }

      el = _duplicateResources.keys();

      if (el != null)
      {
        while (el.hasMoreElements())
        {
          XAResource x = (XAResource) el.nextElement();

          if (x.isSameRM(xaRes))
          {
            TxInfo info = (TxInfo) _resources.get(x);

            if (info.thread() == t)
              return true;
          }
        }
      }
    }
View Full Code Here

Examples of com.arjuna.ats.internal.jta.xa.TxInfo

/*      */   {
/* 1229 */     int state = 5;
/*      */
/* 1231 */     if (xaRes != null)
/*      */     {
/* 1233 */       TxInfo info = (TxInfo)this._resources.get(xaRes);
/*      */
/* 1235 */       if (info == null)
/*      */       {
/* 1237 */         info = (TxInfo)this._duplicateResources.get(xaRes);
/*      */       }
/*      */
/* 1240 */       if (info != null) {
/* 1241 */         state = info.getState();
/*      */       }
/*      */     }
/* 1244 */     return state;
/*      */   }
View Full Code Here

Examples of com.arjuna.ats.internal.jta.xa.TxInfo

/* 1509 */         while (el.hasMoreElements())
/*      */         {
/*      */           try
/*      */           {
/* 1521 */             XAResource xaRes = (XAResource)el.nextElement();
/* 1522 */             TxInfo info = (TxInfo)this._resources.get(xaRes);
/*      */
/* 1524 */             if (info.getState() == 2)
/*      */             {
/* 1526 */               if (XAUtils.mustEndSuspendedRMs(xaRes)) {
/* 1527 */                 xaRes.start(info.xid(), 134217728);
/*      */               }
/* 1529 */               xaRes.end(info.xid(), 67108864);
/* 1530 */               info.setState(1);
/*      */             }
/*      */           }
/*      */           catch (XAException ex)
/*      */           {
/* 1535 */             if (jtaLogger.loggerI18N.isWarnEnabled())
View Full Code Here

Examples of com.arjuna.ats.internal.jta.xa.TxInfo

/*      */         {
/* 1577 */           XAResource x = (XAResource)el.nextElement();
/*      */
/* 1579 */           if (x.isSameRM(xaRes))
/*      */           {
/* 1581 */             TxInfo info = (TxInfo)this._resources.get(x);
/*      */
/* 1583 */             if (info.thread() == t) {
/* 1584 */               return true;
/*      */             }
/*      */           }
/*      */         }
/*      */       }
/* 1589 */       el = this._duplicateResources.keys();
/*      */
/* 1591 */       if (el != null)
/*      */       {
/* 1593 */         while (el.hasMoreElements())
/*      */         {
/* 1595 */           XAResource x = (XAResource)el.nextElement();
/*      */
/* 1597 */           if (x.isSameRM(xaRes))
/*      */           {
/* 1599 */             TxInfo info = (TxInfo)this._resources.get(x);
/*      */
/* 1601 */             if (info.thread() == t)
/* 1602 */               return true;
/*      */           }
/*      */         }
/*      */       }
/*      */     }
View Full Code Here

Examples of com.arjuna.ats.internal.jta.xa.TxInfo

/*      */
/*      */     }
/*      */
/*      */     try
/*      */     {
/*  579 */       TxInfo info = null;
/*      */       try
/*      */       {
/*  588 */         synchronized (this)
/*      */         {
/*  590 */           info = (TxInfo)this._resources.get(xaRes);
/*      */
/*  592 */           if (info == null)
/*      */           {
/*  599 */             info = (TxInfo)this._duplicateResources.get(xaRes);
/*      */           }
/*      */         }
/*      */
/*  603 */         if (info != null)
/*      */         {
/*  605 */           switch (info.getState())
/*      */           {
/*      */           case 2:
/*  615 */             int xaStartResume = theModifier == null ? 134217728 : theModifier.xaStartParameters(134217728);
/*      */
/*  619 */             xaRes.start(info.xid(), xaStartResume);
/*      */
/*  621 */             info.setState(0);
/*      */
/*  623 */             synchronized (this)
/*      */             {
/*  625 */               this._suspendCount -= 1;
/*      */             }
/*      */
/*  628 */             return true;
/*      */           case 0:
/*  637 */             return true;
/*      */           case 1:
/*  645 */             int xaStartJoin = theModifier == null ? 2097152 : theModifier.xaStartParameters(2097152);
/*      */
/*  649 */             xaRes.start(info.xid(), xaStartJoin);
/*      */
/*  651 */             info.setState(0);
/*      */
/*  653 */             return true;
/*      */           }
/*      */
/*  660 */           throw new IllegalStateException("TransactionImple.enlistResource - " + jtaLogger.logMesg.getString("com.arjuna.ats.internal.jta.transaction.arjunacore.illresstate") + ":" + info.getState());
/*      */         }
/*      */
/*      */       }
/*      */       catch (IllegalStateException ex)
/*      */       {
/*  671 */         throw ex;
/*      */       }
/*      */       catch (XAException exp)
/*      */       {
/*  675 */         if (info != null) {
/*  676 */           info.setState(3);
/*      */         }
/*  678 */         if (jtaLogger.loggerI18N.isWarnEnabled())
/*      */         {
/*  680 */           jtaLogger.loggerI18N.warn("com.arjuna.ats.internal.jta.transaction.arjunacore.enlisterror", new Object[] { "TransactionImple.enlistResource", XAHelper.printXAErrorCode(exp) });
/*      */         }
/*      */
/*  688 */         return false;
/*      */       }
/*      */
/*  701 */       Xid xid = null;
/*  702 */       TxInfo existingRM = isNewRM(xaRes);
/*      */
/*  704 */       if (existingRM == null)
/*      */       {
/*  710 */         boolean branchRequired = true;
/*      */
/*  712 */         synchronized (this)
/*      */         {
/*  714 */           if (this._resources.size() == 0)
/*      */           {
/*  718 */             branchRequired = true;
/*      */           }
/*      */         }
/*      */
/*  722 */         xid = createXid(branchRequired, theModifier);
/*      */
/*  724 */         boolean associatedWork = false;
/*  725 */         int retry = 20;
/*      */
/*  740 */         while (!associatedWork)
/*      */         {
/*      */           try
/*      */           {
/*  744 */             if (this._xaTransactionTimeoutEnabled)
/*      */             {
/*  746 */               int timeout = this._theTransaction.getTimeout();
/*      */
/*  748 */               if (timeout > 0)
/*      */               {
/*      */                 try
/*      */                 {
/*  752 */                   xaRes.setTransactionTimeout(timeout);
/*      */                 }
/*      */                 catch (XAException te)
/*      */                 {
/*  756 */                   if (jtaLogger.loggerI18N.isWarnEnabled())
/*      */                   {
/*  758 */                     jtaLogger.loggerI18N.warn("com.arjuna.ats.internal.jta.transaction.arjunacore.timeouterror", new Object[] { "TransactionImple.enlistResource", XAHelper.printXAErrorCode(te), xid });
/*      */                   }
/*      */
/*      */                 }
/*      */
/*      */               }
/*      */
/*      */             }
/*      */
/*  772 */             int xaStartNormal = theModifier == null ? 0 : theModifier.xaStartParameters(0);
/*      */
/*  776 */             xaRes.start(xid, xaStartNormal);
/*      */
/*  778 */             associatedWork = true;
/*      */
/*  780 */             this._resources.put(xaRes, new TxInfo(xid));
/*      */           }
/*      */           catch (XAException e)
/*      */           {
/*  786 */             if ((e.errorCode == -8) || (e.errorCode == -3))
/*      */             {
/*  789 */               if (retry > 0) {
/*  790 */                 xid = createXid(true, theModifier);
/*      */               }
/*  792 */               retry--;
/*      */             }
/*      */             else
/*      */             {
/*  801 */               if (jtaLogger.loggerI18N.isWarnEnabled())
/*      */               {
/*  803 */                 jtaLogger.loggerI18N.warn("com.arjuna.ats.internal.jta.transaction.arjunacore.enliststarterror", new Object[] { "TransactionImple.enlistResource", XAHelper.printXAErrorCode(e), xid });
/*      */               }
/*      */
/*  814 */               markRollbackOnly();
/*      */
/*  816 */               throw e;
/*      */             }
/*      */           }
/*  819 */           if (retry < 0)
/*      */           {
/*  821 */             if (jtaLogger.loggerI18N.isWarnEnabled())
/*      */             {
/*  823 */               jtaLogger.loggerI18N.warn("com.arjuna.ats.internal.jta.transaction.arjunacore.enliststarterror", new Object[] { "TransactionImple.enlistResource", XAHelper.printXAErrorCode(e), xid });
/*      */             }
/*      */
/*  834 */             markRollbackOnly();
/*      */
/*  836 */             throw new SystemException("TransactionImple.enlistResource - XAResource.start " + jtaLogger.logMesg.getString("com.arjuna.ats.internal.jta.transaction.arjunacore.couldnotregister") + ": " + xid);
/*      */           }
/*      */
/*      */         }
/*      */
/*      */       }
/*      */       else
/*      */       {
/*  858 */         xid = existingRM.xid();
/*      */         try
/*      */         {
/*  862 */           int xaStartJoin = theModifier == null ? 2097152 : theModifier.xaStartParameters(2097152);
/*      */
/*  865 */           xaRes.start(xid, xaStartJoin);
/*      */         }
/*      */         catch (XAException ex)
/*      */         {
/*  869 */           if (jtaLogger.loggerI18N.isWarnEnabled())
/*      */           {
/*  871 */             jtaLogger.loggerI18N.warn("com.arjuna.ats.internal.jta.transaction.arjunacore.xastart", new Object[] { "TransactionImple.enlistResource - xa_start ", XAHelper.printXAErrorCode(ex), xid });
/*      */           }
/*      */
/*  881 */           markRollbackOnly();
/*      */
/*  883 */           throw ex;
/*      */         }
/*      */
/*  891 */         this._duplicateResources.put(xaRes, new TxInfo(xid));
/*      */
/*  893 */         return true;
/*      */       }
/*      */       AbstractRecord record;
/*      */       Object record;
View Full Code Here

Examples of com.arjuna.ats.internal.jta.xa.TxInfo

/* 1014 */       break;
/*      */     default:
/* 1016 */       throw new IllegalStateException(jtaLogger.logMesg.getString("com.arjuna.ats.internal.jta.transaction.arjunacore.inactive"));
/*      */     }
/*      */
/* 1021 */     TxInfo info = null;
/*      */     try
/*      */     {
/* 1025 */       synchronized (this)
/*      */       {
/* 1027 */         info = (TxInfo)this._resources.get(xaRes);
/*      */
/* 1029 */         if (info == null) {
/* 1030 */           info = (TxInfo)this._duplicateResources.get(xaRes);
/*      */         }
/*      */       }
/* 1033 */       if (info == null)
/*      */       {
/* 1035 */         if (jtaLogger.loggerI18N.isWarnEnabled())
/*      */         {
/* 1037 */           jtaLogger.loggerI18N.warn("com.arjuna.ats.internal.jta.transaction.arjunacore.unknownresource", new Object[] { "TransactionImple.delistResource" });
/*      */         }
/*      */
/* 1044 */         return false;
/*      */       }
/*      */
/* 1048 */       boolean optimizedRollback = false;
/*      */       try
/*      */       {
/* 1057 */         if (status == 1)
/*      */         {
/* 1059 */           if (XAUtils.canOptimizeDelist(xaRes))
/*      */           {
/* 1061 */             xaRes.end(info.xid(), 536870912);
/* 1062 */             xaRes.rollback(info.xid());
/*      */
/* 1064 */             info.setState(4);
/*      */
/* 1066 */             optimizedRollback = true;
/*      */           }
/*      */         }
/*      */
/*      */       }
/*      */       catch (Exception e)
/*      */       {
/*      */       }
/*      */
/* 1075 */       switch (info.getState())
/*      */       {
/*      */       case 0:
/* 1079 */         if ((flags & 0x4000000) != 0)
/*      */         {
/* 1081 */           xaRes.end(info.xid(), 67108864);
/* 1082 */           info.setState(1);
/*      */         }
/* 1086 */         else if ((flags & 0x2000000) != 0)
/*      */         {
/* 1088 */           xaRes.end(info.xid(), 33554432);
/* 1089 */           info.setState(2);
/*      */
/* 1091 */           synchronized (this)
/*      */           {
/* 1093 */             this._suspendCount += 1;
/*      */           }
/*      */         }
/*      */         else
/*      */         {
/* 1098 */           xaRes.end(info.xid(), 536870912);
/* 1099 */           info.setState(3);
/*      */         }
/*      */
/* 1103 */         break;
/*      */       case 2:
/* 1106 */         if ((flags & 0x4000000) != 0)
/*      */         {
/* 1111 */           if (XAUtils.mustEndSuspendedRMs(xaRes)) {
/* 1112 */             xaRes.start(info.xid(), 134217728);
/*      */           }
/* 1114 */           xaRes.end(info.xid(), 67108864);
/* 1115 */           info.setState(1);
/*      */
/* 1117 */           synchronized (this)
/*      */           {
/* 1119 */             this._suspendCount -= 1;
/*      */           }
/*      */         }
/*      */         else
/*      */         {
/* 1124 */           if ((flags & 0x2000000) != 0)
/*      */           {
/* 1129 */             throw new IllegalStateException("TransactionImple.delistResource - " + jtaLogger.logMesg.getString("com.arjuna.ats.internal.jta.transaction.arjunacore.ressuspended"));
/*      */           }
/*      */
/* 1136 */           xaRes.end(info.xid(), 536870912);
/* 1137 */           info.setState(3);
/*      */
/* 1139 */           synchronized (this)
/*      */           {
/* 1141 */             this._suspendCount -= 1;
/*      */           }
/*      */
/*      */         }
/*      */
/* 1146 */         break;
/*      */       default:
/* 1149 */         if (optimizedRollback) break;
/* 1150 */         throw new IllegalStateException("TransactionImple.delistResource - " + jtaLogger.logMesg.getString("com.arjuna.ats.internal.jta.transaction.arjunacore.illresstate") + ":" + info.getState());
/*      */       }
/*      */
/* 1158 */       info = null;
/*      */
/* 1160 */       return true;
/*      */     }
/*      */     catch (IllegalStateException ex)
/*      */     {
/* 1165 */       throw ex;
/*      */     }
/*      */     catch (XAException exp)
/*      */     {
/* 1169 */       if (info != null) {
/* 1170 */         info.setState(3);
/*      */       }
/*      */
/* 1176 */       markRollbackOnly();
/*      */
/* 1178 */       if (jtaLogger.loggerI18N.isWarnEnabled())
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.