waiting = false;
m = getMessageNow();
   protected Message getMessage(long timeout) throws InterruptedException, JMSException   {      Message m = null;            // If it's receiveNoWait then get the message directly      if (timeout == -1)      {         waiting = false;                  m = getMessageNow();                }      else      {         // ... otherwise we activate the server side consumer and wait for a message to arrive         // asynchronously                  waiting = true;                  activateConsumer();               try         {            if (timeout == 0)            {               //Indefinite wait               m = (Message)buffer.take();            }                        else            {               //wait with timeout               m = (Message)buffer.poll(timeout);            }         }         finally         {            //We only need to call this if we didn't receive a message synchronously            waiting = false;                        if (!closed)            {               if (m == null)               {                  deactivateConsumer();               }            }         }      }                     return m;   }