Package com.sun.messaging.jmq.jmsserver.data

Examples of com.sun.messaging.jmq.jmsserver.data.TransactionUID


                     msg.getSysMessageID().toString());
            reason = "corrupted ack message";
            status = Status.ERROR;
        }

        TransactionUID tid = null;
        if (msg.getTransactionID() != 0) { // HANDLE TRANSACTION
            try {
                tid = new TransactionUID(msg.getTransactionID());
            } catch (Exception ex) {
               logger.log(Logger.ERROR, BrokerResources.E_INTERNAL_BROKER_ERROR,
                     "Internal Error: can not create transactionID for "
                     + msg, ex);
               status = Status.ERROR;
View Full Code Here


          TransactionHandler handler = (TransactionHandler)
                      pr.getHandler(PacketType.START_TRANSACTION);

          // allocated a TID
          TransactionUID id = null;
          if (xaFlags == null ||
              TransactionState.isFlagSet(XAResource.TMNOFLAGS, xaFlags)) {
              id = new TransactionUID();
          } else if (xid != null) {
              TransactionList translist = handler.getTransactionList();

              id = translist.xidToUID(xid);
         
View Full Code Here

         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;
             }
View Full Code Here


    private void sendTransactionInquiries(BrokerAddress broker) {
        TransactionList translist = Globals.getTransactionList();
        ArrayList tids = translist.getPreparedRemoteTransactions();
        TransactionUID tid = null;
        Iterator itr = tids.iterator();
        ClusterTxnInquiryInfo cii = null;
        TransactionBroker txnhome = null;
        while ( itr.hasNext()) {
            tid = (TransactionUID)itr.next();
            txnhome = translist.getRemoteTransactionHomeBroker(tid);
            cii = ClusterTxnInquiryInfo.newInstance(Long.valueOf(tid.longValue()),
                              ((txnhome == null) ? null:txnhome.getBrokerAddress()), null);
            if (DEBUG_CLUSTER_TXN) {
            logger.log(Logger.INFO, "Sending transaction inquiry: " + cii + " to "+broker);
            }
View Full Code Here

        if (DEBUG_CLUSTER_TXN) {
        logger.log(logger.INFO, "Received transaction inquiry "+cii.toString()+ " from "+from);
        }

        TransactionUID tid = new TransactionUID(cii.getTransactionID().longValue());
        BrokerAddress txnHomeBroker = cii.getTransactionHome();
        TransactionBroker thb = null;
        if (txnHomeBroker != null) {
            thb = new TransactionBroker(txnHomeBroker);
        }
View Full Code Here

                              BrokerResources.W_SEND_REMOTE_TXN_INFO_FAIL, args));
        }
    }

    public void sendClusterTransactionInfo(long tid, BrokerAddress to) {
        sendClusterTransactionInfo(new TransactionUID(tid), to, null);
    }
View Full Code Here

                   BrokerResources.I_RECEIVED_TXN_INFO, from.toString(), ii.toString()));
        }

        TransactionList translist = Globals.getTransactionList();
        Long tid = ii.getTransactionID();
        TransactionUID tuid = new TransactionUID(tid.longValue());
        int s = ii.getTransactionState();

        if (!ii.isOwner() || (ii.isOwner() && from.equals(selfAddress))) {
            TransactionState mystate =  translist.retrieveState(tuid, true);
            if (mystate != null && mystate.getState() == TransactionState.COMMITTED) {
View Full Code Here

                        int flags, JMSService.TransactionAutoRollback rollback,
      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);
  } catch(BrokerException be)  {
      String errStr = "startTransaction: start transaction failed. Connection ID: "
      + connectionId
      + ", session ID: "
      + sessionId
      + ", XID: "
      + xid;

            logger.logStack(Logger.ERROR, errStr, be);
      props.put("JMQStatus", getErrorReplyStatus(be));
      throw new JMSServiceException(errStr, be, props);
  }

  props.put("JMQStatus", JMSServiceReply.Status.OK);
  props.put("JMQTransactionID", txnUID.longValue());
  reply = new JMSServiceReply(props, null);

  return (reply);
    }
View Full Code Here

    public JMSServiceReply endTransaction(long connectionId, long transactionId,
            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);
  } catch(BrokerException be)  {
      String errStr = "endTransaction: end transaction failed. Connection ID: "
      + connectionId
      + ", Transaction ID: "
      + transactionId
      + ", XID: "
      + xid;

            logger.logStack(Logger.ERROR, errStr, be);
      props.put("JMQStatus", getErrorReplyStatus(be));
      throw new JMSServiceException(errStr, be, props);
  }

  props.put("JMQStatus", JMSServiceReply.Status.OK);
  props.put("JMQTransactionID", txnUID.longValue());
  reply = new JMSServiceReply(props, null);

  return (reply);
    }
View Full Code Here

    public JMSServiceReply prepareTransaction(long connectionId,
            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  {
      txnUID = new TransactionUID(transactionId);
  }

  try  {
      protocol.prepareTransaction(txnUID, xaFlags);
  } catch(BrokerException be)  {
      String errStr = "prepareTransaction: prepare transaction failed. Connection ID: "
          + connectionId
          + ", Transaction ID: "
          + transactionId
          + ", XID: "
          + xid;

            logger.logStack(Logger.ERROR, errStr, be);
      props.put("JMQStatus", getErrorReplyStatus(be));
      throw new JMSServiceException(errStr, be, props);
  }

  props.put("JMQStatus", JMSServiceReply.Status.OK);
  props.put("JMQTransactionID", txnUID.longValue());
  reply = new JMSServiceReply(props, null);

  return (reply);
    }
View Full Code Here

TOP

Related Classes of com.sun.messaging.jmq.jmsserver.data.TransactionUID

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.