Package com.sun.messaging.jmq.jmsserver.core

Examples of com.sun.messaging.jmq.jmsserver.core.ConsumerUID


            Destination dest, String selector)
                                    throws JMSServiceException  {
  JMSServiceReply reply;
  IMQConnection cxn;
  HashMap props = new HashMap();
  ConsumerUID uid;
  Session session;

        cxn = checkConnectionId(connectionId, "addBrowser");
        session = checkSessionId(sessionId, "addBrowser");

  try  {
      Selector sel = Selector.compile(selector);
  } catch(SelectorFormatException sfe)  {
      String errStr = "addBrowser: Add browser failed. Connection ID: "
      + connectionId
      + ", session ID: "
      + sessionId
      + ", destination: "
      + dest
      + ", selector: "
      + selector;

            logger.logStack(Logger.ERROR, errStr, sfe);
      props.put("JMQStatus", JMSServiceReply.Status.BAD_REQUEST);
      throw new JMSServiceException(errStr, sfe, props);
  }

  uid = new ConsumerUID();
  queueBrowseList.put(uid, new QueueBrowserInfo(dest, selector));

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

  return (reply);
    }
View Full Code Here


            long consumerId)
                                    throws JMSServiceException  {
  JMSServiceReply reply;
  IMQConnection cxn;
  HashMap props = new HashMap();
  ConsumerUID uid;
  Session session;

        cxn = checkConnectionId(connectionId, "deleteBrowser");
        session = checkSessionId(sessionId, "deleteBrowser");

  uid = new ConsumerUID(consumerId);

  if (queueBrowseList.containsKey(uid))  {
      queueBrowseList.remove(uid);
  } else  {
      String errStr = "deleteBrowser: consumer ID not found. Connection ID:"
      + connectionId
      + ", Session ID: "
      + sessionId
      + ", Consumer ID: "
      + consumerId;

            logger.log(Logger.ERROR, errStr);

      props.put("JMQStatus", JMSServiceReply.Status.NOT_FOUND);
      throw new JMSServiceException(errStr, props);
  }

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

  return (reply);
    }
View Full Code Here

    public JMSPacket[] browseMessages(long connectionId, long sessionId,
            long consumerId) throws JMSServiceException  {
  JMSServiceReply reply;
  IMQConnection cxn;
  HashMap props = new HashMap();
  ConsumerUID uid;
  Session session;
  JMSPacket[] msgs = null;

        cxn = checkConnectionId(connectionId, "browseMessages");
        session = checkSessionId(sessionId, "browseMessages");

  uid = new ConsumerUID(consumerId);

  if (queueBrowseList.containsKey(uid))  {
      QueueBrowserInfo qbi = (QueueBrowserInfo)queueBrowseList.get(uid);

      try  {
View Full Code Here

            SysMessageID[] messageIDs, Long[] consumerIds, long transactionId,
            boolean setRedelivered) throws JMSServiceException  {
  JMSServiceReply reply;
  IMQConnection cxn;
  HashMap props = new HashMap();
  ConsumerUID conUIDs[] = null;
        TransactionUID txnUID = null;
  Session session;

        cxn = checkConnectionId(connectionId, "redeliverMessages");
        session = checkSessionId(sessionId, "redeliverMessages");

  if (consumerIds != null)  {
      conUIDs = new ConsumerUID [ consumerIds.length ];
      for (int i = 0; i < consumerIds.length; ++i)  {
          conUIDs[i] = new ConsumerUID(consumerIds[i]);
      }
  }

  if (transactionId != -1)  {
      txnUID = new TransactionUID(transactionId);
View Full Code Here

  HashMap<ConsumerUID,Consumer> consumersNoChildren
        = new HashMap<ConsumerUID,Consumer>();

  while (it.hasNext()) {
      Consumer oneCon = (Consumer)it.next();
      ConsumerUID cid = oneCon.getConsumerUID();

      if (oneCon.getSubscription() == null)  {
                consumersNoChildren.put(cid, oneCon);
      }
  }
View Full Code Here

    }

    public static CompositeData getConsumerInfo(String consumerID)
        throws BrokerException, OpenDataException  {
  CompositeData cd = null;
  ConsumerUID tmpcid, cid = null;
        BrokerResources  rb = Globals.getBrokerResources();

  if (consumerID == null)  {
      throw new
    IllegalArgumentException(rb.getString(rb.X_JMX_NULL_CONSUMER_ID_SPEC));
  }

  long longCid = 0;

  try  {
      longCid = Long.parseLong(consumerID);
  } catch (NumberFormatException e)  {
      throw new
    IllegalArgumentException(rb.getString(rb.X_JMX_INVALID_CONSUMER_ID_SPEC, consumerID));
  }

  tmpcid = new ConsumerUID(longCid);

  Consumer con = Consumer.getConsumer(tmpcid);

  if (con == null)  {
      throw new BrokerException(rb.getString(rb.X_JMX_CONSUMER_NOT_FOUND, consumerID));
View Full Code Here

            for (int i=0; i < ta.length; i ++) {
                if (DEBUG) {
                    logger.log(Logger.INFO, "Load transaction ack "+ta[i]+" [TUID="+tid+"]");
                }
                ConsumerUID cuid = ta[i].getConsumerUID();
                ConsumerUID scuid = ta[i].getStoredConsumerUID();
                SysMessageID sysid = ta[i].getSysMessageID();
                Map imap = (Map)inprocessAcks.get(sysid);
                if (scuid == null) {
                     logger.log(Logger.WARNING,"Internal Error: " +
                         " Unable to locate stored ConsumerUID :" + ta);
                     scuid = cuid;
                     if (ta == null) {
                         logger.log(Logger.WARNING, "Internal Error: "
                            + " no consumerUID stored w/ the transaction:"
                            + ta);
                          continue;
                      }
                }
                   
                if (imap == null) {
                    imap = new HashMap();
                    inprocessAcks.put(sysid, imap);
                }
                imap.put(scuid, tid);
                if (openTransactions.get(tid) != null) {
                    TransactionInformation ti = (TransactionInformation)translist.get(tid);
                    if (ti == null) {
                        logger.log(Logger.INFO, "Unable to retrieve "
                             + " transaction information " + ti +
                             " for " + tid +
                            " we may be clearing the transaction");
                        continue;
                    }
                    if (openTransactions.get(tid) == Boolean.TRUE) {
                        ti.addConsumedMessage(sysid, cuid, scuid);
                    }
                    ti.addOrphanAck(sysid, scuid);
                 }
               

            }
          } catch (Exception ex) {
            logger.logStack(Logger.WARNING,
               BrokerResources.E_INTERNAL_BROKER_ERROR,
               "Error parsing transaction ", ex);
          }
        }

        {
            Object[] args = { Integer.valueOf(prepareCN), Integer.valueOf(commitWaitCN) };
            logger.log(logger.INFO, Globals.getBrokerResources().getKString(
                BrokerResources.I_NCLUSTER_TRANS, args));
        }

        HashMap remoteTrans = store.getAllRemoteTransactionStates();

        // list of transactions which need to be cleaned up
        HashSet clearRemoteTrans = new HashSet(remoteTrans.size());

        int prepareRN = 0, rollbackRN = 0, commitRN = 0, completeRN = 0;
        itr = remoteTrans.entrySet().iterator();
        while (itr.hasNext()) {
          try {
             Map.Entry entry = (Map.Entry)itr.next();
             TransactionUID tid = (TransactionUID)entry.getKey();
             TransactionState ts = (TransactionState)entry.getValue();
             TransactionAcknowledgement  ta[] = store.getTransactionAcks(tid);
             int state = ts.getState();
             if (DEBUG) {
                 logger.log(Logger.INFO, "Load remote transaction: TUID="+tid+
                 "["+TransactionState.toString(state)+
                 (ts.getCreationTime() == 0 ? "":" createTime="+ts.getCreationTime())+"]");
             }
             switch (state) {
                 case TransactionState.CREATED:
                     clearRemoteTrans.add(tid);
                     rollbackRN++;
                     break;
                 case TransactionState.PREPARED:
                     prepareRN++;
                     logRemoteTransaction(tid, ts, ta,
                         store.getRemoteTransactionHomeBroker(tid), true, true, false);
                     openTransactions.put(tid, Boolean.TRUE);
                     break;
                 case TransactionState.COMPLETE:
                     if (Globals.getHAEnabled() && ta != null && ta.length > 0) {
                         completeRN++;
                         ts.setState(TransactionState.PREPARED);
                         logRemoteTransaction(tid, ts, ta,
                           store.getRemoteTransactionHomeBroker(tid), true, true, false);
                         openTransactions.put(tid, Boolean.TRUE);
                         break;
                     }
                 case TransactionState.STARTED:
                 case TransactionState.ROLLEDBACK:
                 case TransactionState.FAILED:
                 case TransactionState.INCOMPLETE:
                     openTransactions.put(tid, Boolean.FALSE);
                     clearRemoteTrans.add(tid);
                     rollbackRN++;
                     break;
                 case TransactionState.COMMITTED:
                     commitRN++;
                     logRemoteTransaction(tid, ts, ta,
                         store.getRemoteTransactionHomeBroker(tid), true, true, false);
                     committingTransactions.put(tid, "");
                     break;
                 default:
                     logger.log(logger.ERROR,
                         "Internal Error unexpected transaction state:"+
                          TransactionState.toString(state)+ " TUID="+tid+", set to PREPARED");
                     logRemoteTransaction(tid, ts, ta,
                         store.getRemoteTransactionHomeBroker(tid), true, true, false);
                     updateRemoteTransactionState(tid, TransactionState.PREPARED, true, true, true)
                     openTransactions.put(tid, Boolean.TRUE);
            }

            for (int i=0; i < ta.length; i ++) {
                if (DEBUG) {
                    logger.log(Logger.INFO, "Load remote transaction ack "+ta[i]+" [TUID="+tid+"]");
                }
                ConsumerUID cuid = ta[i].getConsumerUID();
                ConsumerUID scuid = ta[i].getStoredConsumerUID();
                SysMessageID sysid = ta[i].getSysMessageID();
                Map imap = (Map)inprocessAcks.get(sysid);
                if (scuid == null) {
                     logger.log(Logger.WARNING,"Internal Error: " +
                         " Unable to locate stored ConsumerUID :" + ta);
View Full Code Here

TOP

Related Classes of com.sun.messaging.jmq.jmsserver.core.ConsumerUID

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.