Package com.sun.messaging.jmq.util

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


     
       //result code
       int result = XA_OK;
      
       //this.twoPhasePrepared = false;
       JMQXid jmqXid = null;
      
       if (_connection.isConnectedToHABroker) {
         jmqXid = new JMQXid(foreignXid);
       }
      
       try {
        //two phase commit
        this.prepare (foreignXid, false);
View Full Code Here


    getSentMessages(txnInfo, txnWork);
    getConsumedMessages(txnInfo, txnWork);

    TransactionUID txid = txnInfo.getTID();
    JMQXid xid = txnInfo.getState().getXid();
    LocalTransaction localTxn = new LocalTransaction(txid, state, xid,
        txnWork);
    TransactionState newState = new TransactionState(txnInfo.getState());

    localTxn.setTransactionState(newState);
View Full Code Here

                } else {
                    logger.log(Logger.ERROR , Globals.getBrokerResources().getKString(
                    BrokerResources.E_TRAN_ACK_PROCESSING_FAILED, emsg, ex.getMessage()), ex);
                }
                int state = -1;
                JMQXid xid = null;
                try {
                    TransactionState ts = translist.retrieveState(tid);
                    if (ts != null) {
                        state = ts.getState();
                        xid = ts.getXid();
                    }
                    translist.updateState(tid, TransactionState.FAILED, true);
                } catch (Exception e) {
                    if (!(e instanceof UnknownTransactionException)) {
                    String args[] = { TransactionState.toString(state),
                                      TransactionState.toString(TransactionState.FAILED),
                                      tid.toString()(xid == null ? "null": xid.toString()) };
                    logger.log(Logger.WARNING, Globals.getBrokerResources().getKString(
                                      BrokerResources.W_UPDATE_TRAN_STATE_FAIL, args));
                    }
                }
                if (ex instanceof TransactionAckExistException) {
View Full Code Here

             if (ts.getState() == TransactionState.PREPARED) {
                 v.add(id);
             }
         }

         JMQXid xids[] = new JMQXid[v.size()];
         Iterator itr = v.iterator();
         int i = 0;
         while (itr.hasNext()) {
             TransactionUID tuid = (TransactionUID)itr.next();
             TransactionState _ts = translist.retrieveState(tuid);
             if (_ts == null) {
                 // Should never happen
                 continue;
             }
             JMQXid _xid = _ts.getXid();
             xids[i++]=_xid;

         }
         return xids;
     }
View Full Code Here

    }

    private TransactionInformation addTransactionID(TransactionUID id,
        TransactionState ts, boolean takeover, int type, boolean persist)
        throws BrokerException  {
        JMQXid xid = ts.getXid();

        shareLock.lock();
        try {
            if (inuse_translist.contains(id)) {
                if (!takeover || type != TransactionInfo.TXN_CLUSTER ||
                     translist.containsKey(id) || !remoteTranslist.containsKey(id)) {
                        throw new BrokerException(
                            Globals.getBrokerResources().getKString(
                            BrokerResources.X_TRANSACTIONID_INUSE, id.toString()),
                            BrokerResources.X_TRANSACTIONID_INUSE,
                            (Throwable) null, Status.CONFLICT);
                }
            }

            // If transaction is an XA (has an xid) save it for reverse mapping
            if (xid != null && xidTable.containsKey(xid)) {
                // Xid already in use
                throw new BrokerException(
                    Globals.getBrokerResources().getKString(
                    BrokerResources.X_TRANSACTIONID_INUSE,
                    id.toString() + "[Xid=" + xid.toString() + "]"),
                    BrokerResources.X_TRANSACTIONID_INUSE,
                    (Throwable) null,
                    Status.CONFLICT);
            }
        } finally {
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

      long timeout) throws JMSServiceException  {
  JMSServiceReply reply;
  HashMap props = new HashMap();
  IMQConnection cxn;
  TransactionUID txnUID = null;
  JMQXid jmqXid = null;
  Integer xaFlags = null;
  boolean isXA = false;
  AutoRollbackType type = null;

        cxn = checkConnectionId(connectionId, "startTransaction");

  if (xid != null)  {
      isXA = true;
      jmqXid = new JMQXid(xid);
      xaFlags = new Integer(flags);
  }

  try  {
      txnUID = protocol.startTransaction(jmqXid, xaFlags, type, timeout, cxn);
View Full Code Here

            Xid xid, int flags) throws JMSServiceException  {
  JMSServiceReply reply;
  HashMap props = new HashMap();
  IMQConnection cxn;
  TransactionUID txnUID = null;
  JMQXid jmqXid = null;
  Integer xaFlags = null;
  long tid = 0;

        cxn = checkConnectionId(connectionId, "endTransaction");

  txnUID = new TransactionUID(transactionId);

  if (xid != null)  {
      jmqXid = new JMQXid(xid);
      xaFlags = new Integer(flags);
  }

  try  {
      protocol.endTransaction(txnUID, jmqXid, xaFlags);
View Full Code Here

            long transactionId, Xid xid) throws JMSServiceException  {
  JMSServiceReply reply;
  HashMap props = new HashMap();
  IMQConnection cxn;
  TransactionUID txnUID = null;
  JMQXid jmqXid = null;
  Integer xaFlags = null;

        cxn = checkConnectionId(connectionId, "prepareTransaction");

  /*
   * If transactionId is 0, extract it from XID
   */
  if (transactionId == 0)  {
      jmqXid = new JMQXid(xid);
      /*
      xaFlags = new Integer(flags);
      */
      txnUID = Globals.getTransactionList().xidToUID(jmqXid);
  } else  {
View Full Code Here

        throws JMSServiceException  {
  JMSServiceReply reply;
  HashMap props = new HashMap();
  IMQConnection cxn;
  TransactionUID txnUID = null;
  JMQXid jmqXid = null;
  Integer xaFlags;
  long tid = 0;

        cxn = checkConnectionId(connectionId, "commitTransaction");

  txnUID = new TransactionUID(transactionId);
        if (xid != null)
      jmqXid = new JMQXid(xid);

  xaFlags = new Integer(flags);

  try  {
      protocol.commitTransaction(txnUID, jmqXid, xaFlags, cxn);
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.