new LocalQueue(consumerID));
new LocalQueue(consumerID), selector);
	public ConsumerDelegate createConsumerDelegate(Destination jmsDestination,                                                  String selector,                                                  boolean noLocal,                                                  String subscriptionName)		throws JMSException   {      // look-up destination      DestinationManagerImpl dm = serverPeer.getDestinationManager();          AbstractDestination destination = dm.getCoreDestination(jmsDestination);           // create the MessageConsumer dynamic proxy      String stackName = "ConsumerStack";      AdviceStack stack = AspectManager.instance().getAdviceStack(stackName);      // TODO why do I need to the advisor to create the interceptor stack?      Interceptor[] interceptors = stack.createInterceptors(serverPeer.getSessionAdvisor(), null);      JMSConsumerInvocationHandler h = new JMSConsumerInvocationHandler(interceptors);      String consumerID = generateConsumerID();      SimpleMetaData metadata = new SimpleMetaData();      metadata.addMetaData(Dispatcher.DISPATCHER, Dispatcher.OID, serverPeer.getConsumerAdvisor().getName(), PayloadKey.AS_IS);      metadata.addMetaData(InvokerInterceptor.REMOTING,                           InvokerInterceptor.INVOKER_LOCATOR,                           serverPeer.getLocator(),                           PayloadKey.AS_IS);      metadata.addMetaData(InvokerInterceptor.REMOTING,                           InvokerInterceptor.SUBSYSTEM,                           "JMS",                           PayloadKey.AS_IS);      // TODO: Is this really necessary? Can't I just use the consumerID?      metadata.addMetaData(JMSAdvisor.JMS, JMSAdvisor.CONNECTION_ID, connectionEndpoint.getConnectionID(), PayloadKey.AS_IS);      metadata.addMetaData(JMSAdvisor.JMS, JMSAdvisor.SESSION_ID, sessionID, PayloadKey.AS_IS);      metadata.addMetaData(JMSAdvisor.JMS, JMSAdvisor.CONSUMER_ID, consumerID, PayloadKey.AS_IS);      metadata.addMetaData(JMSAdvisor.JMS, JMSAdvisor.SELECTOR, selector, PayloadKey.AS_IS);      metadata.addMetaData(JMSAdvisor.JMS, JMSAdvisor.DESTINATION, jmsDestination);      h.getMetaData().mergeIn(metadata);      // TODO      ClassLoader loader = getClass().getClassLoader();      Class[] interfaces = new Class[] { ConsumerDelegate.class };      ConsumerDelegate delegate = (ConsumerDelegate)Proxy.newProxyInstance(loader, interfaces, h);      if (callbackHandler == null)      {         throw new JMSException("null callback handler");      }            DurableSubscriptionHolder subscription = null;      if (subscriptionName != null)      {         String clientID = connectionEndpoint.getClientID();         if (clientID == null)         {            throw new JMSException("Cannot create durable subscriber without having set client ID");         }                           //It's a durable subscription - have we already got one with that name?         ClientManager clientManager = serverPeer.getClientManager();                  subscription = clientManager.getDurableSubscription(clientID, subscriptionName);         // TODO - this makes MessageConsumerTest.testDurableSubscriptionOnlyOneConsumer() fail         //         if (subscription != null)//         {//            throw new javax.jms.IllegalStateException("There is already a '" + subscriptionName +//                                                      "' durable subscription!");//         }         //FIXME - race condition here - can result in multiple subscribers of same subscription         if (subscription == null)         {            if (!(destination instanceof LocalTopic))            {               throw new JMSException("Cannot only create a durable subscription on a topic");            }            LocalTopic topic = (LocalTopic)destination;            subscription = new DurableSubscriptionHolder(subscriptionName, topic,                                                         new LocalQueue(consumerID));            clientManager.addDurableSubscription(clientID, subscriptionName, subscription);            //start it            destination.add(subscription.getQueue());         }         subscription.setHasConsumer(true);      }            ServerConsumerDelegate scd =         new ServerConsumerDelegate(consumerID,                                    subscriptionName == null ? destination : subscription.getQueue(),                                    callbackHandler, this, selector, noLocal, subscription);            //The connection may have already been started - so the consumer must be started      if (this.connectionEndpoint.started)      {         scd.setStarted(true);      }            putConsumerDelegate(consumerID, scd);      connectionEndpoint.receivers.put(consumerID, scd);      if (log.isTraceEnabled()) log.trace("created consumer endpoint (destination=" + jmsDestination + ")");      return delegate;   }