Package com.sun.messaging.jmq.util

Examples of com.sun.messaging.jmq.util.JMQXid


        if (_logger.isLoggable(Level.FINE)){
        _logger.fine(_lgrMID_INF+"XAResourceForMC ("+this.hashCode()+") Commit  "+printXid(foreignXid)+" (onePhase="+onePhase+")");
        }

        //convert to jmq xid
        JMQXid jmqXid = new JMQXid(foreignXid);
        //Debug.println("MQRA:XAR4RA:commit():onePhase="+onePhase+" tid="+transactionID+" xid="+jmqXid.toString());
        if (onePhase && setRollback) {
            //Debug.println("*=*=*=*=*=*=*=*=*=*=XAR:commit1p:forcing Rollback due to:" + rollbackCause.getMessage());
            Debug.printStackTrace(rollbackCause);
            XAException xae = new XAException(XAException.XAER_RMFAIL);
            xae.initCause(rollbackCause);
            throw xae;
        }
        try {
            if (!epConnection._isClosed()) {
                //epConnection.getProtocolHandler().commit(0L,
                //    (onePhase ? XAResource.TMONEPHASE : XAResource.TMNOFLAGS), jmqXid);
           
              if ( onePhase ) {
                //one phase commit
                if ( epConnection.isConnectedToHABroker() ) {
                  //use two phase protocol for HA
                  HAOnePhaseCommit (foreignXid, jmqXid);
                } else {
                  epConnection.getProtocolHandler().commit(0L, XAResource.TMONEPHASE, jmqXid);
                }
              } else {
                //tow phase commit
                if ( epConnection.isConnectedToHABroker() ) {
                  //HA case
                  this.HATwoPhaseCommit (jmqXid);
                } else {
                  //non-HA
                  epConnection.getProtocolHandler().commit(0L,
                            XAResource.TMNOFLAGS, jmqXid);
                }
              }
             
            } else {
                System.err.println("MQRA:XARFRA:commit:ConnectionClosed:throw XAExc txn:1p="+onePhase+":xid="+jmqXid.toString());
                //Debug.println("*=*=*=*=*=*=*=*=*=*=XAR:commit:XAException");
                XAException xae = new XAException(XAException.XAER_RMFAIL);
                throw xae;
            }
        } catch (Exception jmse) {
View Full Code Here


        if (_logger.isLoggable(Level.FINE)){
        _logger.fine(_lgrMID_INF+"XAResourceForRA ("+this.hashCode()+") End     "+printXid(foreignXid)+printFlags(flags));
        }
     
        //convert to jmq xid
        JMQXid jmqXid = new JMQXid(foreignXid);
        //Debug.println("MQRA:XAR4RA:end():flags="+flags+" tid="+transactionID+" xid="+jmqXid.toString());
       
        if (epConnection._isClosed()) {
            //Debug.println("*=*=*=*=*=*=*=*=*=*=XAR:end:XAException");
            XAException xae = new XAException(XAException.XAER_RMFAIL);
View Full Code Here

        }

        //JMS does not do RDONLY transactions - right?
        int result = XA_OK;
        //convert to jmq xid
        JMQXid jmqXid = new JMQXid(foreignXid);
        //Debug.println("*=*=*=*=*=*=*=*=*=*=XAR:prepare:txid=\n"+jmqXid.toString());
        if (setRollback) {
            //Debug.println("*=*=*=*=*=*=*=*=*=*=XAR:prepare:forcing Rollback due to:" + rollbackCause.getMessage());
            Debug.printStackTrace(rollbackCause);
            XAException xae = new XAException(XAException.XAER_RMFAIL);
View Full Code Here

        if (_logger.isLoggable(Level.FINE)){
        _logger.fine(_lgrMID_INF+"XAResourceForMC ("+this.hashCode()+") Rollback  "+printXid(foreignXid)+")");
        }   

        //convert to jmq xid
        JMQXid jmqXid = new JMQXid(foreignXid);
        //Debug.println("MQRA:XAR4RA:rollback():tid="+transactionID+" xid="+jmqXid.toString());
        try {
            //send rollback w/redeliver
            if (!epConnection._isClosed()) {
               
View Full Code Here

        if (_logger.isLoggable(Level.FINE)){
        _logger.fine(_lgrMID_INF+"XAResourceForRA ("+this.hashCode()+") Start   "+printXid(foreignXid)+printFlags(flags));
        }

        //convert to jmq xid
        JMQXid jmqXid = new JMQXid(foreignXid);
        //Debug.println("MQRA:XAR4RA:start():flags="+flags+" xid="+jmqXid.toString());
       
        // if we're reverting to the pre-6882044 behaviour always send the START to the broker
        // otherwise send the START to the broker only if this is not a TMRESUME
      if (!isResume(flags) || ResourceAdapter.isRevert6882044()){   
View Full Code Here

            }
            break;

        case PacketType.RECOVER_TRANSACTION_REPLY:
            try {
                JMQXid xid;
                Integer quantity = (Integer)props.get("JMQQuantity");
                n = 0;
                if (quantity != null) {
                    n = quantity.intValue();
                }

                DataInputStream dis = new DataInputStream(is);
                while (n > 0) {
                    xid = JMQXid.read(dis);
                    os.println("[XID=" + xid + "], ");
                    n--;
                }
            } catch (IOException e) {
                os.println("Could not decode XIDs: " + e);
            }
            break;

        case PacketType.INFO:

            try {
                ObjectInputStream dis = new ObjectInputStream(is);
                Hashtable ht = (Hashtable)dis.readObject();
                Iterator itr = ht.entrySet().iterator();
                while (itr.hasNext()) {
                    Map.Entry mEntry = (Map.Entry)itr.next();
                    Object key = mEntry.getKey();
                    Object value = mEntry.getValue();
                    if (value instanceof Hashtable) {
                       os.println("\tTable: " + key);

                       Iterator itr1 = ((Hashtable)value).entrySet().iterator();
                       while (itr1.hasNext()) {
                           Map.Entry mEntry1 = (Map.Entry)itr1.next();
                           Object key1 = mEntry1.getKey();
                           Object value1 = mEntry1.getValue();
                           os.println("\t\t"+key1 + "=" + value1 );
                       }
                    } else {
                        os.println("\t"+key + "=" + value );
                    }
                }
            } catch (Exception e) {
                os.println("Could not decode INFO packet: " + e);
            }
             break;

        case PacketType.START_TRANSACTION:
        case PacketType.COMMIT_TRANSACTION:
        case PacketType.ROLLBACK_TRANSACTION:
        case PacketType.END_TRANSACTION:
        case PacketType.PREPARE_TRANSACTION:
        case PacketType.RECOVER_TRANSACTION:
            try {
                JMQXid xid;
                xid = JMQXid.read(new DataInputStream(is));
                os.println("[XID=" + xid + "]");
            } catch (IOException e) {
                os.println("Could not decode XID: " + e);
            }
View Full Code Here

                    ConsumerUID storeduid = (e.getStoredUID() == null ? cuid:e.getStoredUID());

                    // deal w/ orphan messages
                    TransactionUID tid = e.getTUID();
                    if (tid != null) {
                        JMQXid jmqxid = Globals.getTransactionList().UIDToXid(tid);
                        if (jmqxid != null) {
                            Globals.getTransactionList().addOrphanAck(
                                    tid, e.getSysMessageID(), storeduid, cuid);
                            itr.remove();
                            continue;
View Full Code Here

  }


        if (ts == null) return null;

        JMQXid xid = tl.UIDToXid(id);

        Hashtable table = new Hashtable();

  table.put("type", new Integer(type));

        if (xid != null) {
            table.put("xid", xid.toString());
        }

        table.put("txnid", new Long(id.longValue()));
        if (ts.getUser() != null)
            table.put("user", ts.getUser());
View Full Code Here

                        (ts.getState() < TransactionState.STARTED ||
                         ts.getState() > TransactionState.PREPARED)) {
                status = Status.PRECONDITION_FAILED;
          errMsg = rb.getString(rb.E_INVALID_TXN_STATE_FOR_ROLLBACK, tid);
            } else {
                JMQXid xid = tl.UIDToXid(tid);

                if (xid == null &&
                    (!(Globals.getHAEnabled() &&
                       ts.getState() == TransactionState.PREPARED))) {
        /*
 
View Full Code Here

    }

    // Copy constructor;
    public TransactionState(TransactionState ts) {
        // Unfortunately JMQXid is mutable, so we must make a copy
        this.xid = new JMQXid(ts.xid);

        // Strings are immutable, so we just assign them
        this.state = ts.state;
        this.user = ts.user;
        this.clientID = ts.clientID;
View Full Code Here

TOP

Related Classes of com.sun.messaging.jmq.util.JMQXid

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.