if (log.isTraceEnabled()) { log.trace("sending " + ref + " to the core"); }
if (log.isTraceEnabled()) { log.trace("sending " + ref + " to the core, destination: " + jmsDestination.getName()); }
   void sendMessage(Message m) throws JMSException   {      //The JMSDestination header must already have been set for each message      JBossDestination jmsDestination = (JBossDestination)m.getJMSDestination();      if (jmsDestination == null)      {         throw new IllegalStateException("JMSDestination header not set!");      }            Channel coreDestination = null;            DestinationManagerImpl dm = serverPeer.getDestinationManager();      coreDestination = dm.getCoreDestination(jmsDestination);            if (coreDestination == null)      {         throw new JMSException("Destination " + jmsDestination.getName() + " does not exist");      }            //This allows the no-local consumers to filter out the messages that come from the      //same connection      //TODO Do we want to set this for ALL messages. Possibly an optimisation is possible here      ((JBossMessage)m).setConnectionID(connectionID);            Routable r = (Routable)m;      MessageReference ref = null;            try      {         // Reference (cache) the message         // TODO - this should be done in an interceptor                  ref = serverPeer.getMessageStore().reference(r);      }      catch(Throwable t)      {         log.error("Failed to cache message", t);         throw new JBossJMSException("Failed to cache the message", t);      }            if (log.isTraceEnabled()) { log.trace("sending " + ref + " to the core"); }            Delivery d = coreDestination.handle(null, ref);            // The core destination is supposed to acknowledge immediately. If not, there's a problem.      if (d == null || !d.isDone())      {         String msg = "The message was not acknowledged by destination " + coreDestination;         log.error(msg);         throw new JBossJMSException(msg);      }   }