MessageProxy m = (MessageProxy)queue.get(i);
MessageProxy m = (MessageProxy)mesList.get(i);
   public void run()   {      if (trace) { log.trace("running connection consumer"); }      try      {         LinkedList queue = new LinkedList();         while (true)         {                        if (closed)            {               if (trace) { log.trace("Connection consumer is closed, breaking"); }               break;            }                        if (queue.isEmpty())            {               // Remove up to maxMessages messages from the consumer               for (int i = 0; i < maxMessages; i++)               {                                 // receiveNoWait                  if (trace) { log.trace(this + " attempting to get message with receiveNoWait"); }                  Message m = null;                                    if (!closed)                  {                     m = cons.receive(-1);                  }                                    if (m == null)                  {                     if (trace) { log.trace("receiveNoWait did not retrieve any message"); }                     break;                  }                  if (trace) { log.trace("receiveNoWait got message " + m + " adding to queue"); }                  queue.addLast(m);               }               if (queue.isEmpty())               {                  // 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(this + " attempting to get message with blocking receive (no timeout)"); }                  Message m = null;                                    if (!closed)                  {                     m = cons.receive(0);                  }                                    if (m != null)                  {                     if (trace) { log.trace("receive (no timeout) got message " + m + " 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;                  }               }            }                        if (!queue.isEmpty())            {               if (trace) { log.trace("there are " + 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(this + ": session " + session + " did not have a set MessageListener"); }               }               for (int i = 0; i < queue.size(); i++)               {                  MessageProxy m = (MessageProxy)queue.get(i);                  session.addAsfMessage(m, consumerID, cons);                  if (trace) { log.trace("added " + m + " to session"); }               }               if (trace) { log.trace(this + " starting serverSession " + serverSession); }               serverSession.start();               if (trace) { log.trace(this + "'s serverSession processed messages"); }               queue.clear();            }                     }         if (trace) { log.trace("ConnectionConsumer run() exiting"); }      }      catch (JMSException e)      {         //Receive interrupted - ignore      }      catch (Throwable t)      {         log.error("Caught Throwable in processing run()", t);               }         }