if (!connectionEndpoint.temporaryDestinations.contains(d))
if (!connectionEndpoint.hasTemporaryDestination(d))
	public ConsumerDelegate createConsumerDelegate(Destination jmsDestination,                                                  String selector,                                                  boolean noLocal,                                                  String subscriptionName,                                                  boolean isCC) throws JMSException   {      if (closed)      {         throw new IllegalStateException("Session is closed");      }            if ("".equals(selector))      {         selector = null;      }            JBossDestination d = (JBossDestination)jmsDestination;            if (trace) { log.trace("creating consumer endpoint for " + d + ", selector " + selector + ", " + (noLocal ? "noLocal, " : "") + "subscription " + subscriptionName); }                  if (d.isTemporary())      {         // Can only create a consumer for a temporary destination on the same connection         // that created it         if (!connectionEndpoint.temporaryDestinations.contains(d))         {            String msg = "Cannot create a message consumer on a different connection " +                         "to that which created the temporary destination";            throw new IllegalStateException(msg);         }      }            CoreDestination coreDestination = dm.getCoreDestination(jmsDestination);      if (coreDestination == null)      {         throw new InvalidDestinationException("No such destination: " + jmsDestination);      }                int consumerID = connectionEndpoint.serverPeer.getNextObjectID();           CoreSubscription subscription = null;      if (d.isTopic())      {         Topic topic = (Topic)coreDestination;         if (subscriptionName == null)         {            // non-durable subscription            if (log.isTraceEnabled()) { log.trace("creating new non-durable subscription on " + coreDestination); }            subscription = new CoreSubscription(topic, selector, noLocal, ms);         }         else         {            if (d.isTemporary())            {               throw new InvalidDestinationException("Cannot create a durable subscription on a temporary topic");            }                        // we have a durable subscription, look it up            String clientID = connectionEndpoint.getClientID();            if (clientID == null)            {               throw new JMSException("Cannot create durable subscriber without a valid client ID");            }            subscription = dsm.getDurableSubscription(clientID, subscriptionName, dm, ms, tl);            if (subscription == null)            {               if (trace) { log.trace("creating new durable subscription on " + coreDestination); }               subscription = dsm.createDurableSubscription(d.getName(),                                                            clientID,                                                            subscriptionName,                                                            selector,                                                            noLocal,                                                            dm, ms, tl);            }            else            {               if (trace) { log.trace("subscription " + subscriptionName + " already exists"); }               // From javax.jms.Session Javadoc (and also JMS 1.1 6.11.1):               // A client can change an existing durable subscription by creating a durable               // TopicSubscriber with the same name and a new topic and/or message selector.               // Changing a durable subscriber is equivalent to unsubscribing (deleting) the old               // one and creating a new one.               boolean selectorChanged =                  (selector == null && subscription.getSelector() != null) ||                  (subscription.getSelector() == null && selector != null) ||                  (subscription.getSelector() != null && selector != null &&                  !subscription.getSelector().equals(selector));               if (trace) { log.trace("selector " + (selectorChanged ? "has" : "has NOT") + " changed"); }               // TODO - if we use hard equality here, redeploying (re-activating) a topic will               //        cause loosing all messages waiting on durable subscriptions on that topic               //boolean topicChanged = subscription.getTopic() != coreDestination;               boolean topicChanged =                  !subscription.getTopic().getName().equals(coreDestination.getName());               if (log.isTraceEnabled()) { log.trace("topic " + (topicChanged ? "has" : "has NOT") + " changed"); }                              boolean noLocalChanged = noLocal != subscription.isNoLocal();               if (selectorChanged || topicChanged || noLocalChanged)               {                  if (trace) { log.trace("topic or selector or noLocal changed so deleting old subscription"); }                  boolean removed =                     dsm.removeDurableSubscription(connectionEndpoint.clientID, subscriptionName);                  if (!removed)                  {                     throw new InvalidDestinationException("Cannot find durable subscription " +                                                           subscriptionName + " to unsubscribe");                  }                  subscription.unsubscribe();                  // create a fresh new subscription                  subscription = dsm.createDurableSubscription(d.getName(),                                                               clientID,                                                               subscriptionName,                                                               selector,                                                               noLocal,                                                               dm, ms, tl);               }            }         }      }            ServerConsumerEndpoint ep =         new ServerConsumerEndpoint(consumerID,                                    subscription == null ? (Channel)coreDestination : subscription,                                    this, selector, noLocal);             JMSDispatcher.instance.registerTarget(new Integer(consumerID), new ConsumerAdvised(ep));               ClientConsumerDelegate stub = new ClientConsumerDelegate(consumerID);            if (subscription != null)      {         subscription.subscribe();      }                  putConsumerDelegate(consumerID, ep);            connectionEndpoint.consumers.put(new Integer(consumerID), ep);      log.debug("created and registered " + ep);      return stub;   }