} catch (JMSException e) {
   public void run()   {      if (trace) { log.trace("running connection consumer"); }      try      {         LinkedList queue = new LinkedList();         outer: while (true)         {            if (closed)            {               if (trace) { log.trace("Connection consumer is closed, breaking"); }               break outer;            }                        if (queue.isEmpty())            {               //Remove up to maxMessages messages from the consumer                        for (int i = 0; i < maxMessages; i++)               {                                 //receiveNoWait                  if (trace) { log.trace("Attempting to get message with receiveNoWait"); }                  Message m = null;                                    if (!closed)                  {                     m = cons.receive(-1);                  }                  if (m == null)                  {                     if (trace) { log.trace("Didn't get message"); }                     break;                  }                  if (trace) { log.trace("Got message, adding to queue"); }                  queue.addLast(m);               }               if (queue.isEmpty() && !closed)               {                  //We didn't get any messages doing receiveNoWait, so let's wait                  //This returns if a message is received or by the consumer closing                  if (trace) { log.trace("Getting message with blocking receive"); }                  Message m = null;                                    if (!closed)                  {                     m = cons.receive(0);                  }                  if (m != null)                  {                     if (trace) { log.trace("Got message, adding to queue"); }                     queue.addLast(m);                  }                  else                  {                     //The consumer must have closed                     if (trace) { log.trace("Blocking receive returned null, consumer must have closed"); }                     break outer;                  }               }            }                        if (!queue.isEmpty() && !closed)            {               if (trace) { log.trace("I have " + queue.size() + " messages to send to session"); }               ServerSession serverSession = serverSessionPool.getServerSession();               JBossSession session = (JBossSession)serverSession.getSession();                              MessageListener listener = session.getMessageListener();                              if (listener == null)               {                  //Sanity check                  if (trace)                     log.trace("Session did not have a set MessageListener " + session + " " + this);               }               for (int i = 0; i < queue.size(); i++)               {                  session.addAsfMessage((Message) queue.get(i), receiverID);                  if (trace) { log.trace("Added message to session"); }               }               if (trace) { log.trace(" Starting the ServerSession=" + serverSession + " " + this); }               serverSession.start();               if (trace) { log.trace("ServerSession processed messages"); }               queue.clear();            }         }         if (trace) { log.trace("ConnectionConsumer run() exiting"); }      }      catch (Throwable t)      {         log.error("Caught Throwable in processing run()", t);               }         }   