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

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


            if (target instanceof com.sun.messaging.jmq.jmsserver.core.Consumer)
            {
                // notify on the ConsumerUID
                com.sun.messaging.jmq.jmsserver.core.Consumer cc =
                       (com.sun.messaging.jmq.jmsserver.core.Consumer) target;
                ConsumerUID cuid = cc.getConsumerUID();
                if (cc.isBusy()) {
                    synchronized (cuid) {
                        // we cant check isBusy in here - we can deadlock
                        // so instead look in the cuidNotify hashtable

                        cuidNotify.add(cuid);
                        //ok, we want to wake up the thread currently in
                        // getNextConsumerPacket.
                        // it is waiting on the ConsumerUID
                        // so do a notify on ConsumerUID
                            cuid.notifyAll();
                    }
                }
                return;
            }
View Full Code Here


        }
        boolean remoteStatus = false;
        StringBuffer remoteConsumerUIDs = null;
        List cleanList = null;
        SysMessageID ids[] = null;
        ConsumerUID cids[] = null;
        try {
            if (status == Status.OK) {
                DataInputStream is = new DataInputStream(
                msg.getMessageBodyStream());

                // pull out the messages into two lists
                ids = new SysMessageID[ackcount];
                cids = new ConsumerUID[ackcount];
                for (int i = 0; i < ackcount; i ++) {
                    long newid = is.readLong();
                    cids[i] = new ConsumerUID(newid);
                    cids[i].setConnectionUID(con.getConnectionUID());
                    ids[i] new SysMessageID();
                    ids[i].readID(is);
                }
                if (JMQValidate) {
                    if (ackType == DEAD_REQUEST ||
                           ackType == UNDELIVERABLE_REQUEST) {
                        status = Status.BAD_REQUEST;
                        reason = "Can not use JMQValidate with ackType of "
                                  + ackType;
                    } else if (tid == null) {
                        status = Status.BAD_REQUEST;
                        reason = "Can not use JMQValidate with no tid ";
                    } else if (!validateMessages(tid, ids, cids)) {
                        status = Status.NOT_FOUND;
                        reason = "Acknowledgement not processed";
                    }
                } else if (ackType == DEAD_REQUEST) {
                     cleanList = handleDeadMsgs(con, ids, cids, deadrs,
                                                deadthr, deadcmt, deliverCnt);
                } else if (ackType == UNDELIVERABLE_REQUEST) {
                     cleanList = handleUndeliverableMsgs(con, ids, cids);
                } else {
                    if (tid != null) {
                        cleanList= handleTransaction(con, tid, ids, cids);
                     } else  {
                        cleanList = handleAcks(con, ids, cids, msg.getSendAcknowledge());
                     }
                }
           }

        } catch (Throwable thr) {
            status = Status.ERROR;
            if (thr instanceof BrokerException) {
                status = ((BrokerException)thr).getStatusCode();
                remoteStatus = ((BrokerException)thr).isRemote();
                if (remoteStatus && ids != null && cids != null) {
                    remoteConsumerUIDs = new StringBuffer();
                    remoteConsumerUIDs.append(((BrokerException)thr).getRemoteConsumerUIDs());
                    remoteConsumerUIDs.append(" ");
                    String cidstr = null;
                    ArrayList remoteConsumerUIDa = new ArrayList();
                    for (int i = 0; i < ids.length; i++) {
                        PacketReference ref = Destination.get(ids[i]);
                        Consumer c = Consumer.getConsumer(cids[i]);
                        if (c == null) continue;
                        ConsumerUID sid = c.getStoredConsumerUID();
                        if (sid == null || sid.equals(cids[i])) {
                            continue;
                        }
                        BrokerAddress ba = (ref == null ? null: ref.getAddress());
                        BrokerAddress rba = ((BrokerException)thr).getRemoteBrokerAddress();
                        if (c != null && ref != null &&
View Full Code Here

                } else if (c.getConsumerUID().getBrokerAddress() !=
                           Globals.getClusterBroadcast().getMyAddress())
                {
                     // remote consumer
                     PacketReference ref = Destination.get(ids[i]);
                     ConsumerUID cuid = c.getConsumerUID();
                     // right now we dont store messages for remote
                     // brokers so the sync flag is unnecessary
                     // but who knows if that will change
                     if (ref.acknowledged(cuid, c.getStoredConsumerUID(),
                                          !cuid.isDupsOK(), true, ackack)) {
                           l.add(ref);
                     }

                 } else {
                     logger.log(Logger.INFO,
View Full Code Here

                    throw new BrokerException(
                          Globals.getBrokerResources().getKString(
                          BrokerResources.I_ACK_FAILED_NO_CONSUMER, cids[i]), Status.NOT_FOUND);
                }
                // try and find the stored consumerUID
                ConsumerUID sid = consumer.getStoredConsumerUID();

                // if we still dont have a session, attempt to find one
                if (s == null) {
                    SessionUID suid = consumer.getSessionUID();
                    s = Session.getSession(suid);
View Full Code Here

        return sysid;
    }

    public ConsumerUID readPayloadConsumerUID() throws Exception {
        assert ( dis != null );
        ConsumerUID intid =  ClusterConsumerInfo.readConsumerUID(dis);
        if (c != null) {
            BrokerAddress ba = c.unmarshalBrokerAddress(pkt);
            if (ba != null) intid.setBrokerAddress(ba);
        }
        return intid;
    }
View Full Code Here

        byte[] buf = ackack.getPayload().array();
        ByteArrayInputStream bis = new ByteArrayInputStream(buf);
        DataInputStream dis = new DataInputStream(bis);
        SysMessageID sysid = null;
        ConsumerUID intid = null;
        try {
            for (int i = 0; i < cnt; i++) {
                sysid = new SysMessageID();
                sysid.readID(dis);
                intid =  ClusterConsumerInfo.readConsumerUID(dis);
View Full Code Here

                  bufsize = (Integer)props.get("JMQRBufferSize");
              }

              Long cuid = (Long)props.get("JMQConsumerID");
              if (cuid != null) {
                  ConsumerUID tmpuid = new ConsumerUID(cuid.longValue());
                  consumer = Consumer.getConsumer(tmpuid);
              }
          }

          if (DEBUG)
View Full Code Here

    /**
     * Caller must catch RuntimeException and getCause
     */
    public Object next() throws RuntimeException {
        try {
        ConsumerUID cid =  ClusterConsumerInfo.readConsumerUID(dis);
        if (from != null) cid.setBrokerAddress(from);
        count_read++;
        return cid;
        } catch (IOException e) {
        count_read = -1;
        throw new RuntimeException(e);
View Full Code Here

        pkt.setPacketType(PacketType.BROWSE_REPLY);

        Hashtable hash = new Hashtable();

        // pass back a generated ID
        ConsumerUID uid = new ConsumerUID();
        hash.put("JMQConsumerID", new Long(uid.longValue()));

        Hashtable props = null;
        byte[] body = null;

        String destination = null;
View Full Code Here

    public static void writeConsumer(Consumer consumer, DataOutputStream dos)
                       throws IOException
    {
        String destName = consumer.getDestinationUID().getName();
        ConsumerUID id = consumer.getConsumerUID();
        String durableName = null;
        String clientID = null;
        String selstr = consumer.getSelectorStr();
        boolean noLocalDelivery = consumer.getNoLocal();
        boolean isQueue = consumer.getDestinationUID().isQueue();
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.