Package javax.transaction.xa

Examples of javax.transaction.xa.XAException


      Map xids = getXids();
      synchronized (xids)
      {
         String state = (String) xids.get(gid);
         if (state != SUSPENDED && state != ENDED) {
            XAException xaex = new XAException("Invalid prepare state=" + state + " xid=" + gid + " " + this);
            xaex.errorCode = XAException.XAER_PROTO;
            throw xaex;
         }
         if (failInPrepare)
         {
            XAException xae = new XAException(xaCode + " for " + this);
            xae.errorCode = xaCode;
            throw xae;
         }
         xids.put(gid, PREPARED);
         return XA_OK;
View Full Code Here


   }

   void checkDestroyedXAException() throws XAException
   {
      if (destroyed.get()) {
          XAException xaex = new XAException("Already destroyed " + this);
          xaex.errorCode = XAException.XAER_PROTO;
          throw xaex;
      }
   }
View Full Code Here

         delisted = true;
      }
     
      public void forget(Xid arg0) throws XAException
      {
         throw new XAException("NYI");
      }
View Full Code Here

         return XAResource.XA_OK;
      }

      public Xid[] recover(int arg0) throws XAException
      {
         throw new XAException("NYI");
      }
View Full Code Here

         throw new XAException("NYI");
      }

      public void rollback(Xid arg0) throws XAException
      {
         throw new XAException("NYI");
      }
View Full Code Here

        if (JPOXLogger.TRANSACTION.isDebugEnabled())
        {
           JPOXLogger.TRANSACTION.debug(LOCALISER.msg("015039", "delist", xaRes, getXAFlag(flag), toString()));
        }

        XAException exception = null;

        try
        {
            xaRes.end(xid, flag);
        }
View Full Code Here

     *                     current transaction for this XAResource object.
     */
    private void validateXid(Xid xid) throws XAException {

        if (xid == null) {
            throw new XAException("Null Xid");
        }

        if (this.xid == null) {
            throw new XAException(
                "There is no live transaction for this XAResource");
        }

        if (!xid.equals(this.xid)) {
            throw new XAException(
                "Given Xid is not that associated with this XAResource object");
        }
    }
View Full Code Here

                                                       + xid);
*/
        JDBCXAResource resource = xaDataSource.getResource(xid);

        if (resource == null) {
            throw new XAException("The XADataSource has no such Xid:  " + xid);
        }

        resource.commitThis(onePhase);
    }
View Full Code Here

    *         if some work was committed and some work was rolled back
    */
    public void commitThis(boolean onePhase) throws XAException {

        if (onePhase && state == XA_STATE_PREPARED) {
            throw new XAException(
                "Transaction is in a 2-phase state when 1-phase is requested");
        }

        if ((!onePhase) && state != XA_STATE_PREPARED) {
            throw new XAException("Attempt to do a 2-phase commit when "
                                  + "transaction is not prepared");
        }

        //if (!onePhase) {
        //  throw new XAException(
        //   "Sorry.  HSQLDB has not implemented 2-phase commits yet");
        //}
        try {

            /**
             * @todo:  Determine if work was committed, rolled back, or both,
             * and return appropriate Heuristic*Exception.
             * connection.commit();
             *  Commits the real, physical conn.
             */
            connection.commit();
        } catch (SQLException se) {
            throw new XAException(se.getMessage());
        }

        dispose();
    }
View Full Code Here

    public void end(Xid xid, int flags) throws XAException {

        validateXid(xid);

        if (state != XA_STATE_STARTED) {
            throw new XAException("Invalid XAResource state");
        }

        /** @todo - probably all flags can be ignored */
        if (flags == XAResource.TMSUCCESS) {

        }

        try {
            connection.setAutoCommit(originalAutoCommitMode);    // real/phys.
        } catch (SQLException se) {
            throw new XAException(se.getMessage());
        }

        state = XA_STATE_ENDED;
    }
View Full Code Here

TOP

Related Classes of javax.transaction.xa.XAException

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.