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

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


      /*
       * If wildcard param is not null, check for matches
       * If it is null, return total count of wildcards
       */
      if (wildcard != null)  {
          DestinationUID id = oneCon.getDestinationUID();
          if (id.getName().equals(wildcard))  {
              count++;
          }
      } else  {
          count++;
      }
View Full Code Here


  while (consumers.hasNext()) {
      ConsumerUID cid = (ConsumerUID)consumers.next();
      Consumer oneCon = Consumer.getConsumer(cid);

      if (oneCon.isWildcard())  {
    DestinationUID id = oneCon.getDestinationUID();
          al.add(id.getName());
      }
  }

  if (al.size() > 0)  {
      list = new String [ al.size() ];
View Full Code Here

                logger.log(Logger.DEBUG,"Removing " +
                      sysid + " because of rollback");
            }
            PacketReference ref = Destination.get(sysid);
            if (ref == null) continue;
            DestinationUID duid = ref.getDestinationUID();
            Destination d = Destination.getDestination(duid);
            d.removeMessage(sysid, RemoveReason.ROLLBACK);
        }

        // remove from our active connection list
View Full Code Here

      con.sendControlMessage(pkt);
    }
   
    Producer pausedProducer = checkFlow(msg, con)
    if (pausedProducer!=null){
      DestinationUID duid = DestinationUID.getUID(msg.getDestination(),
                msg.getIsQueue());
      Destination d = Destination.findDestination(duid);
      pauseProducer(d, duid, pausedProducer, con);
    }
View Full Code Here

    while (consumers.hasNext())  {
        Consumer oneCon = (Consumer)consumers.next();

        if (oneCon.isWildcard())  {
      DestinationUID id = oneCon.getDestinationUID();
      String wildcard = id.getName();

      Integer count = h.get(wildcard), newCount;

      if (count == null)  {
          newCount = new Integer(1);
      } else  {
          newCount = new Integer(count.intValue() + 1);
      }
      h.put(wildcard, newCount);
        }
    }
      }
      if (h.size() > 0)  {
          di.consumerWildcards = h;
      }

      h = new Hashtable<String, Integer>();
      if (di.nProducers > 0)  {
    Iterator producers = d.getProducers();

    while (producers.hasNext())  {
        Producer oneProd = (Producer)producers.next();

        if (oneProd.isWildcard())  {
      DestinationUID id = oneProd.getDestinationUID();
      String wildcard = id.getName();

      Integer count = h.get(wildcard), newCount;

      if (count == null)  {
          newCount = new Integer(1);
View Full Code Here

        int status = Status.OK;

        Vector v = null;
        String err = null;
        try {
                DestinationUID duid = null;
                if (destination != null)
                    duid= DestinationUID.getUID(
                         destination, false);
   
                Set s = Subscription.getAllSubscriptions(duid);
View Full Code Here

            d.getDestinationName());
            } catch (Exception ex) {

                // remove the destination
                try {
                    DestinationUID duid = DestinationUID.getUID(
                        info.name, DestType.isQueue(type));
                    Destination.removeDestination(duid, false, ex.toString());
                } catch (Exception ex1) {
                    // if we cant destroy .. its ok .. ignore the exception
                }
View Full Code Here

                fi.checkFaultAndExit(FaultInjection.FAULT_SEND_MSG_1,
                     m, 2, false);
            }


            DestinationUID realduid = DestinationUID.getUID(msg.getDestination(),
                msg.getIsQueue());

            // get the list of "real" destination UIDs (this will be one if the
            // destination if not a wildcard and 0 or more if it is

            List duids = Destination.findMatchingIDs(realduid);

            boolean packetUsed = false;


            // IMPORTANT NOTE:
            // IF A MESSAGE IS BEING SENT TO A WILDCARD TOPIC AND A FAILURE
            // OCCURS ON ONE OF THE SENDS PROCESSING THAT MESSAGE WILL CONTINUE
            // A MESSAGE WILL BE LOGGED
            //
            // THIS FACT NEEDS TO BE DOCUMENTED SOMEWHERE

            if (duids.size() == 0) {
                route = false; // nothing to do
            } else {
                Iterator itr = duids.iterator();
                while (itr.hasNext()) {
                    PacketReference ref = null;
                    Exception lastthr = null;
                    boolean isLast = false;
                    DestinationUID duid = (DestinationUID)itr.next();
                    isLast = !itr.hasNext();


                    Destination d = Destination.getDestination(duid);
                    try {

                        if (d == null) {
                            throw new BrokerException("Unknown Destination:" + msg.getDestination());
                        }
                        if (realduid.isWildcard() && d.isTemporary()) {
                            logger.log(Logger.DEBUG,"L10N-XXX: Wildcard production with destination name of "
                                         + realduid +  " to temporary destination " +
                                         d.getUniqueName() + " is not supported, ignoring");
                             continue;
                        }
                        if (realduid.isWildcard() && d.isInternal()) {
                            logger.log(Logger.DEBUG,"L10N-XXX: Wildcard production with destination name of "
                                         + realduid +  " to internal destination " +
                                         d.getUniqueName() + " is not supported, ignoring");
                             continue;
                        }

                        if (realduid.isWildcard() && d.isDMQ() ) {
                            logger.log(Logger.DEBUG,"L10N-XXX: Wildcard production with destination name of "
                                         + realduid +  " to the DeadMessageQueue" +
                                         d.getUniqueName() + " is not supported, ignoring");
                             continue;
                        }
                        if (pausedProducer != null) {
                             pauseProducer(d, duid, pausedProducer, con);
                             pausedProducer = null;
                        }
   
                        if (packetUsed) {
                            // create a new Packet for the message
                            // we need a new sysmsgid with it
                            Packet newp = new Packet();
                            newp.fill(msg);
                            newp.generateSequenceNumber(true);
                            newp.generateTimestamp(true);
                            newp.prepareToSend();
                            newp.generateSequenceNumber(false);
                            newp.generateTimestamp(false);
                            msg = newp;
                        }
                        packetUsed = true;
   
                        // OK generate a ref. This checks message size and
                        // will be needed for later operations
                        ref = createReference(msg, duid, con, isadmin);
   
                        // dont bother calling route if there are no messages
                        //
                        // to improve performance, we route and later forward
                        route |= queueMessage(d, ref, transacted);
   
                        // ok ...
                        if (isLast && route && ack && !ref.isPersistent()) {
                            sendAcknowledge(refid, cid, status, con, reason, props, transacted);
                            ack = false;
                        }
   
   
                        Set s = routeMessage(transacted, ref, route, d);
                      
                        if (s != null && ! s.isEmpty()) {
                           if (routedSet == null)
                               routedSet = new HashMap();
                            routedSet.put(ref, s);
                        }

                        // handle producer flow control
                        pauseProducer(d, duid, pausedProducer, con);
                    } catch (Exception ex) {
                        if (ref != null) {
                            if (failedrefs == null)
                                failedrefs = new ArrayList();
                            failedrefs.add(ref);
                        }
                        lastthr = ex;
                        logger.log(Logger.DEBUG, BrokerResources.W_MESSAGE_STORE_FAILED,
                              con.toString(), ex);
                    } finally {
                        if (pausedProducer != null) {
                            pauseProducer(d, duid, pausedProducer, con);
                            pausedProducer = null;
                        }
                        if (isLast && lastthr != null) {
                            throw lastthr;
                        }
                    }
                } //while
            }

        } catch (BrokerException ex) {

            // dont log on dups if indemponent
            int loglevel = (isIndemp && ex.getStatusCode()
                   == Status.NOT_MODIFIED) ? Logger.DEBUG
                      : Logger.WARNING;
            logger.log(loglevel,
                      BrokerResources.W_MESSAGE_STORE_FAILED,
                      con.toString(), ex);
            reason =  ex.getMessage();

            //LKS - we may want an improved error message in the wildcard case

            status = ex.getStatusCode();
        } catch (IOException ex) {
            logger.log(Logger.WARNING, BrokerResources.W_MESSAGE_STORE_FAILED,
                      con.toString(), ex);
            reason =  ex.getMessage();
            status = Status.ERROR;
        } catch (SecurityException ex) {
            logger.log(Logger.WARNING, BrokerResources.W_MESSAGE_STORE_FAILED,
                      con.toString(), ex);
            reason =  ex.getMessage();
            status = Status.FORBIDDEN;
        } catch (OutOfMemoryError err) {
            logger.logStack(Logger.WARNING, BrokerResources.W_MESSAGE_STORE_FAILED,
                      con.toString() + ":" + msg.getPacketSize(), err);
            reason =  err.getMessage();
            status = Status.ERROR;
        } catch (Exception ex) {

            logger.logStack(Logger.WARNING, BrokerResources.W_MESSAGE_STORE_FAILED,
                      con.toString(), ex);
             reason =  ex.getMessage();
             status = Status.ERROR;
        }

        if (status == Status.ERROR && failedrefs != null ) {
            // make sure we remove the message
            //
            // NOTE: we only want to remove the last failure (its too late
            // for the rest).  In the non-wildcard case, this will be the
            // only entry. In the wildcard cause, it will be the one that had an issue
            Iterator itr = failedrefs.iterator();
            while (itr.hasNext()) {
                PacketReference ref = (PacketReference)itr.next();
                Destination d = Destination.getDestination(ref.getDestinationUID());
                if (d != null)
                    cleanupOnError(d, ref);

            }
        }

        if (ack)
            sendAcknowledge(refid, cid, status, con, reason, props, transacted);

        if (route && routedSet != null) {
            Iterator itr = routedSet.keySet().iterator();
            while (itr.hasNext()) {
                PacketReference pktref = (PacketReference)itr.next();
                DestinationUID duid = pktref.getDestinationUID();
                Destination dest = Destination.getDestination(duid);
                Set s = (Set)routedSet.get(pktref);
                forwardMessage(dest, pktref, s);
            }
        }
View Full Code Here

                  try {
                      boolean isQueue = false;
                      if (targetType.equals("q")) {
                          isQueue = true;
                      }
                      DestinationUID uid = null;
                      Destination d = null;
                     
                      if (status != Status.ERROR) {
                          uid = DestinationUID.getUID(target,isQueue);
                          d = Destination.getDestination(uid);
                      }
                      if (status != Status.ERROR && d == null) {
                          status = Status.ERROR;
                          msg = "Error listing consumers on destination  " + target +
                             " unknown destination";
                      } else if (status != Status.ERROR) {
                          Iterator itr = d.getConsumers();
                          if (!itr.hasNext()) {
                              status = Status.ERROR;
                              msg = "No consumers on destination  " + target ;
                          }
     
                          while (itr.hasNext()) {
                              Consumer c = (Consumer)itr.next();
                              IMQConnection cxn = (IMQConnection)
                              Globals.getConnectionManager()
                                  .getConnection(c.getConnectionUID());
                              debugHash.put(String.valueOf(
                                  c.getConsumerUID().longValue()),
                                  (cxn == null ? "" : cxn.getRemoteConnectionString())  + " ["
                                  + String.valueOf((c.getConnectionUID() == null ?
                                                    "none":c.getConnectionUID().longValue())) + "]");
                          }
                      }
                   } catch (Exception ex) {
                       status = Status.ERROR;
                       msg = "Error listing consumers on connection  " + target +
                         " because " + ex.toString();
                      logger.logStack(Logger.INFO,msg, ex);
                   }
              } else if (targetType.equals("ses")) {
                  try {
                      SessionUID uid = new SessionUID(
                          Long.parseLong(target));
                      Session ses = Session.getSession(uid);
                      if (ses == null) {
                          status = Status.ERROR;
                          msg = "Error listing consumers on session  "
                             + target + " unknown sessionUID";
                      } else {
                          Iterator itr = ses.getConsumers();
                          if (!itr.hasNext()) {
                              status = Status.ERROR;
                              msg = "No consumers on session  " + target ;
                          }
                          while (ses != null && itr.hasNext()) {
                              Consumer c = (Consumer)itr.next();
                              if (uid.equals(c.getConnectionUID())) {
                                  debugHash.put(String.valueOf(
                                        c.getConsumerUID().longValue()),
                                        c.getDestinationUID().toString());
                              }
                          }
                      }
                } catch (Exception ex) {
                    status = Status.ERROR;
                    msg = "Error listing consumers on connection  " + target +
                         " because " + ex.toString();
                    logger.logStack(Logger.INFO,msg, ex);
                }
              } else if (targetType.equals("cxn")) {
                  try {
                      ConnectionUID uid = new ConnectionUID(
                          Long.parseLong(target));
                      IMQConnection cxn = (IMQConnection)
                          Globals.getConnectionManager()
                                  .getConnection(uid);
                      if (cxn == null) {
                          status = Status.ERROR;
                          msg = "Error listing consumers on connection  " + target +
                             " unknown connectionUID";
                      } else {
                          Iterator itr = Consumer.getAllConsumers();
                          while (cxn != null && itr.hasNext()) {
                              Consumer c = (Consumer)itr.next();
                              if (uid.equals(c.getConnectionUID())) {
                                  debugHash.put(String.valueOf(
                                        c.getConsumerUID().longValue()),
                                        c.getDestinationUID().toString());
                              }
                          }
                      }
                } catch (Exception ex) {
                    status = Status.ERROR;
                    msg = "Error listing consumers on connection  " + target +
                         " because " + ex.toString();
                    logger.logStack(Logger.INFO,msg, ex);
                }
              } else  {
                  status = Status.ERROR;
                  msg = "Unknown targetType (-t) " + target
                        + "\n Valid formats are of the form: "
                        + "[q|t|ses|cxn]";
              }
            } else if (cmdarg.equals("prd")) {
           debugHash = new Hashtable();
             
              if (target == null) { // all
                  Iterator itr = Producer.getAllProducers();
                  while (itr.hasNext()) {
                      Producer c = (Producer)itr.next();
                      IMQConnection cxn = (IMQConnection)
                          Globals.getConnectionManager()
                              .getConnection(c.getConnectionUID());
                      debugHash.put(String.valueOf(
                             c.getProducerUID().longValue()),
                             cxn.getRemoteConnectionString()  + " ["
                            +  String.valueOf(c.getConnectionUID()
                                 .longValue()) + "]");
                  }
              } else if (targetType == null) {
                  msg = "Please supply targetType if you are supplying a target ";
                  status = Status.ERROR;
              } else if (targetType.equals("t") || targetType.equals("q")) {
                  // destination
                  boolean isQueue = false;
                  if (targetType.equals("q")) {
                     isQueue = true;
                  }
                  try {
                      DestinationUID uid = DestinationUID.getUID(target, isQueue);
                      Destination d = Destination.getDestination(uid);
                      if (d == null) {
                          status = Status.ERROR;
                          msg = "Error listing producers on destination  " + target +
                             " unknown destination";
                      } else {
                          Iterator itr = d.getProducers();
                          while (itr.hasNext()) {
                              Producer c = (Producer)itr.next();
                              IMQConnection cxn = (IMQConnection)
                              Globals.getConnectionManager()
                                  .getConnection(c.getConnectionUID());
                              debugHash.put(String.valueOf(
                                  c.getProducerUID().longValue()),
                                  cxn.getRemoteConnectionString()  + " ["
                                  + String.valueOf(c.getConnectionUID()
                                     .longValue()) + "]");
                          }
                      }
                   } catch (Exception ex) {
                       status = Status.ERROR;
                       msg = "Error listing producers on connection  " + target +
                         " because " + ex.toString();
                      logger.logStack(Logger.INFO,msg, ex);
                   }
              } else if (targetType.equals("cxn")) {
                  try {
                      ConnectionUID uid = new ConnectionUID(
                          Long.parseLong(target));
                      IMQConnection cxn = (IMQConnection)
                          Globals.getConnectionManager()
                                  .getConnection(uid);
                      if (cxn == null) {
                          status = Status.ERROR;
                          msg = "Error listing producers on connection  " + target +
                             " unknown connectionUID";
                      } else {
                          Iterator itr = Producer.getAllProducers();
                          while (cxn != null && itr.hasNext()) {
                              Producer c = (Producer)itr.next();
                              if (uid.equals(c.getConnectionUID())) {
                                  debugHash.put(String.valueOf(
                                        c.getProducerUID().longValue()),
                                        c.getDestinationUID().toString());
                              }
                          }
View Full Code Here

                    isQueue = true;
                } else {
                    throw new Exception("Unknown -t argument " + targetType +
                        " expected t or q");
                }
                DestinationUID uid = DestinationUID.getUID(
                      target, isQueue);
                return getDestinationInfo(uid);
            }
        } else if (arg.equals("ses")) {
            if (target == null) {
View Full Code Here

TOP

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

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.