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

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


                               BrokerResources.X_UNKNOWN_DURABLE_INTEREST,
                               durableName, clientID),
                          Status.NOT_FOUND);
             }
             DestinationUID dest_uid = usub.getDestinationUID();
             Destination d = Destination.getDestination(dest_uid);
             assert d != null;
             if (d != null)
                 d.removeConsumer(uid, true);
        } else {
            boolean redeliver = false;
            if (con.getClientProtocolVersion() < Connection.RAPTOR_PROTOCOL ) {
                redeliver = true;
            }

            if (session == null && !isIndemp) {
                if (con.getConnectionState() >= Connection.STATE_CLOSED) {
                    throw new BrokerException(Globals.getBrokerResources().getKString(
                    BrokerResources.X_CONNECTION_CLOSING, con.getConnectionUID()), Status.NOT_FOUND);
                } else {
                    assert session != null;
                    throw new BrokerException(Globals.getBrokerResources().getKString(
                    BrokerResources.X_CONSUMER_SESSION_NOT_FOUND, uid, con.getConnectionUID()), Status.NOT_FOUND);
                }
            }

            if (session != null) { // should only be null w/ indemp
                Consumer c = session.detatchConsumer(uid, lastid, redeliver, redeliverAll);
                if (DEBUG) {
                logger.log(Logger.INFO, "Closed consumer "+c+", with {lastid="+lastid+", redeliver="+
                           redeliver+ ", redeliverAll="+redeliverAll+", isindemp="+isIndemp+"}");
                }
                DestinationUID dest_uid = c.getDestinationUID();
                Destination d = Destination.getDestination(dest_uid);
                if (d != null)
                    d.removeConsumer(uid, true);
            }
        }
    }
View Full Code Here


        logger.log(Logger.INFO, BrokerResources.I_PURGING_DESTINATION,
                 destination , criteria_str);

        try {
            // for now .. just delete all
            Destination d = Destination.getDestination(destination, DestType.isQueue(destType.intValue()));
            if (d == null) {
                errMsg = Globals.getBrokerResources().getKString(
                          BrokerResources.E_NO_SUCH_DESTINATION,
                          getDestinationType(destType.intValue()), destination);
                Exception e = new BrokerException(errMsg);
                e.fillInStackTrace();
                status = Status.ERROR;
                logger.log(Logger.WARNING, BrokerResources.W_ADMIN_OPERATION_FAILED,
e);
            } else {

              // audit logging for purge destination
              Globals.getAuditSession().destinationOperation(
                  con.getUserName(), con.remoteHostString(),
                  MQAuditSession.PURGE_DESTINATION,
                  d.isQueue() ? MQAuditSession.QUEUE:MQAuditSession.TOPIC,
                  d.getDestinationName());

              d.purgeDestination();
            }
        } catch (BrokerException ex) {
            status = Status.ERROR;
            errMsg = getMessageFromException(ex);
            logger.log(Logger.WARNING, BrokerResources.W_ADMIN_OPERATION_FAILED, ex);
View Full Code Here

            c.setCreator(consumerString);
            newc = c;
            newc.pause("Consumer: new consumer");

            // OK, determine if we are a wildcard or not
            Destination d = Destination.getDestination(dest_uid);
            boolean wildcard = dest_uid.isWildcard();

            // NOTE: if d == null, wildcard == true

            int cprefetch = size;
            int dprefetch = (wildcard ? -1 : (!shared
                    ? d.getMaxPrefetch()
                    : d.getSharedConsumerFlowLimit()));
                                      
            prefetch = (dprefetch == -1) ?
                    cprefetch :
                    (cprefetch == -1 ? cprefetch 
                    : (cprefetch > dprefetch?
                    dprefetch : cprefetch));
            c.setPrefetch(prefetch,useFlowControl);

            // actual subscription added to the destination
            if (durablename != null) {
            // durable
            // get the subscription ... this may throw
            // an exception IF we cant
                sub = Subscription.
                findCreateDurableSubscription(clientid,
                        durablename, dest_uid, selector,
                        nolocal,
                        true);
                sub.pause("Consumer attaching to durable");
   
                sub.setShared(shared);
                // add the consumer .. this may throw an
                // exception IF
                sub.attachConsumer(c, con);
                c.localConsumerCreationReady();
  
                List dests = Destination.findMatchingIDs(dest_uid);
                Iterator itr = dests.iterator();
                while (itr.hasNext()) {
                    DestinationUID c_duid = (DestinationUID) itr.next();
                    Destination dd = Destination.getDestination(c_duid);
                    Subscription oldsub = (Subscription)dd.addConsumer(sub, true, con);
                    if (oldsub != null) {
                        oldsub.purge();
                    }
                }
                sub.sendCreateSubscriptionNotification(c);
            } else if ((wildcard || !d.isQueue()) && shared) {
              // non-durable
                if (clientid == null) {
                    throw new BrokerException(
                        Globals.getBrokerResources().getKString(
                        BrokerResources.X_NON_DURABLE_SHARED_NO_CLIENTID,d.toString()),
                        BrokerResources.X_NON_DURABLE_SHARED_NO_CLIENTID,
                        null,
                        Status.PRECONDITION_FAILED);
                }
                // shared
                logger.log(Logger.DEBUG,"Creating shared non-durable "
                            + c);
                sub = Subscription.createAttachNonDurableSub(c, con);
                c.localConsumerCreationReady();
                if (sub != null) {
                    sub.pause("Consumer: attaching to nondurable");
                    sub.setShared(true);
                    List dests = Destination.findMatchingIDs(dest_uid);
                    Iterator itr = dests.iterator();
                    while (itr.hasNext()) {
                        DestinationUID c_duid = (DestinationUID) itr.next();
                        Destination dd = Destination.getDestination(c_duid);
                        dd.addConsumer(sub, true, con);
                    }
                }
                c.attachToConnection(con.getConnectionUID());
                //c.sendCreateConsumerNotification();
                if (sub != null)
                    sub.sendCreateSubscriptionNotification(c);
            } else {
                c.localConsumerCreationReady();
              // non-durable
                List dests = Destination.findMatchingIDs(dest_uid);
                Iterator itr = dests.iterator();
                while (itr.hasNext()) {
                    DestinationUID c_duid = (DestinationUID) itr.next();
                    Destination dd = Destination.getDestination(c_duid);
                    dd.addConsumer(c, true, con);
                }
                c.attachToConnection(con.getConnectionUID());
                c.sendCreateConsumerNotification();
            }
        }

        if (fi.FAULT_INJECTION) {
            //e.g. imqcmd debug fault -n consumer.add.1 -o selector="mqDestinationName = 'T:t0.*'" -debug
            HashMap fips = new HashMap();
            fips.put(FaultInjection.DST_NAME_PROP,
                     DestinationUID.getUniqueString(dest_uid.getName(), dest_uid.isQueue()));
            fi.checkFaultAndSleep(FaultInjection.FAULT_CONSUMER_ADD_1, fips);
        }
        session.attachConsumer(c);

        Consumer[] retc = new Consumer[3];
        retc[0]=c;
        retc[1]=newc;
        retc[2]=sub;
        return retc;
    } catch (Exception e) {
        Object[] args = { (durablename==null ? "":"["+clientid+":"+durablename+"]"),
                          con, dest_uid };
        String emsg = Globals.getBrokerResources().getKString(
                          BrokerResources.W_ADD_AUTO_CONSUMER_FAILED, args);
        logger.logStack(logger.ERROR, emsg, e);
        try {
            if (c != null) {
                try {
                    session.detatchConsumer(c.getConsumerUID(), null, false, false);
                } catch (Exception e1) {
                    try {
                    c.destroyConsumer((new HashSet()), null, true, false, true);
                    } catch (Exception e2) {}
                };
            }
            List dests = Destination.findMatchingIDs(dest_uid);
            Iterator itr = dests.iterator();
            while (itr.hasNext()) {
                DestinationUID c_duid = (DestinationUID) itr.next();
                Destination dd = Destination.getDestination(c_duid);
                try {
                    if (c != null) {
                        dd.removeConsumer(c.getConsumerUID(), true);
                    }
                    if (sub != null) {
                        dd.removeConsumer(sub.getConsumerUID(), true);
                    }
                } catch (Exception e1){}
            }
            try {
                if (sub != null && c != null) {
View Full Code Here

  Iterator itr = Destination.getAllDestinations();
  ArrayList al = new ArrayList();

  while (itr.hasNext()) {
      Destination oneDest = (Destination)itr.next();
      if (!isVisibleDestination(oneDest))  {
          continue;
      }
      al.add(oneDest);
  }
View Full Code Here

  Iterator itr = Destination.getAllDestinations();
  ArrayList al = new ArrayList();

  while (itr.hasNext()) {
      Destination oneDest = (Destination)itr.next();
      if (!isVisibleDestination(oneDest))  {
          continue;
      }

      if (!oneDest.isTemporary())  {
          continue;
      }

      ConnectionUID cxnId = oneDest.getConnectionUID();
      if (cxnId == null)  {
    continue;
      }

      if (!(cxnId.longValue() == connectionID))  {
View Full Code Here

    public static void pauseAllDestinations(int internalPauseType)  {
        Iterator itr = Destination.getAllDestinations();

        while (itr.hasNext()) {
            Destination d =(Destination)itr.next();
            /*
             * Skip internal, admin, or temp destinations.
             * Skipping temp destinations may need to be
             * revisited.
             */
            if (d.isInternal() || d.isAdmin() || d.isTemporary())  {
                continue;
            }

            d.pauseDestination(internalPauseType);
        }

    }
View Full Code Here

    public static void resumeAllDestinations()  {
        Iterator itr = Destination.getAllDestinations();

        while (itr.hasNext()) {
            Destination d =(Destination)itr.next();
            if (d.isPaused()) {
                d.resumeDestination();
            }
        }
    }
View Full Code Here

  BrokerResources rb = Globals.getBrokerResources();
  Logger logger = Globals.getLogger();

        while (itr.hasNext()) {
            // make sure all are paused
            Destination d = (Destination)itr.next();

            /*
             * Skip internal, admin, or temp destinations.
             * Skipping temp destinations may need to be
             * revisited.
             */
            if (d.isInternal() || d.isAdmin() || d.isTemporary())  {
                continue;
            }

            if (!d.isPaused()) {
                docompact = false;
                String msg = rb.getString(
                        rb.E_SOME_DESTINATIONS_NOT_PAUSED);
                errMsg = rb.getString(rb.X_COMPACT_DSTS_EXCEPTION, msg);

    throw (new BrokerException(errMsg));
            }
        }

        if (docompact) {
            itr = Destination.getAllDestinations();
            while (itr.hasNext()) {
                Destination d = (Destination)itr.next();

                /*
                 * Skip internal, admin, or temp destinations.
                 * Skipping temp destinations may need to be
                 * revisited.
                 */
                if (d.isInternal() || d.isAdmin() || d.isTemporary())  {
                    continue;
                }

                d.compact();
            }
        }
    }
View Full Code Here

        }

        if (status == Status.OK) {
            try {

                Destination d = Destination.getDestination(info.name, DestType.isQueue(type));

                d.setCapacity(maxMessages);
                d.setByteCapacity(maxMessageBytes);
                d.setMaxByteSize(maxMessageSize);
                if (info.isModified(info.DEST_SCOPE)) {
                    int scope = info.destScope;
                    d.setScope(scope)
                }
                if (info.isModified(info.DEST_LIMIT)) {
                    int destlimit = info.destLimitBehavior;
                    d.setLimitBehavior(destlimit);
                }
                if (info.isModified(info.DEST_PREFETCH)) {
                    int prefetch = info.maxPrefetch;
                    d.setMaxPrefetch(prefetch);
                }
                if (info.isModified(info.DEST_CDP)) {
                    int clusterdeliverypolicy = info.destCDP;
                    d.setClusterDeliveryPolicy(clusterdeliverypolicy);
                }
                if (info.isModified(info.MAX_ACTIVE_CONSUMERS)) {
                    int maxcons = info.maxActiveConsumers;
                    d.setMaxActiveConsumers(maxcons);
                }
                if (info.isModified(info.MAX_PRODUCERS)) {
                    int maxp = info.maxProducers;
                    d.setMaxProducers(maxp);
                }
                if (info.isModified(info.MAX_FAILOVER_CONSUMERS)) {
                    int maxcons = info.maxFailoverConsumers;
                    d.setMaxFailoverConsumers(maxcons);
                }
                if (info.isModified(info.MAX_SHARED_CONSUMERS)) {
                    int maxsharedcons = info.maxNumSharedConsumers;
                    d.setMaxSharedConsumers(maxsharedcons);
                }
                if (info.isModified(info.SHARE_FLOW_LIMIT)) {
                    int sflowlimit = info.sharedConsumerFlowLimit;
                    d.setSharedFlowLimit(sflowlimit);
                }
                if (info.isModified(info.USE_DMQ)) {
                    boolean dmq = info.useDMQ;
                    d.setUseDMQ(dmq);
                }
                d.update();
             
    /*
    // audit logging for create destination
    Globals.getAuditSession().destinationOperation(
      con.getUserName(), con.remoteHostString(),
View Full Code Here

      if ((destinationName == null) || (destinationType == null))  {
    throw new BrokerException("Destination name and type not specified");
      }

      Destination d = Destination.getDestination(destinationName,
      (destinationType.equals(DestinationType.QUEUE)));

      if (d == null)  {
    throw new BrokerException(rb.getString(rb.X_DESTINATION_NOT_FOUND,
                 destinationName));
      }

      if (getBody == null)  {
    getBody = Boolean.FALSE;
      }

      if (messageID != null)  {
    d.load();

          SysMessageID sysMsgID = SysMessageID.get(messageID);
                PacketReference  pr = getPacketReference(sysMsgID);

    if (pr != null)  {
        HashMap h = constructMessageInfo(sysMsgID,
            getBody.booleanValue(),
            destNameType);

        msgInfo.add(h);
    } else  {
        throw new BrokerException("Could not locate message "
          + messageID
          + " in destination "
          + destinationName);
    }
      } else  {
    SysMessageID sysMsgIDs[] = d.getSysMessageIDs(startMsgIndex, maxNumMsgsRetrieved);

          for (int i = 0;i < sysMsgIDs.length; ++i)  {
        HashMap h = constructMessageInfo(sysMsgIDs[i],
          getBody.booleanValue(),
          destNameType);
View Full Code Here

TOP

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

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.