m.doBeforeReceipt();
   protected JBossMessage getMessage(long timeout) throws InterruptedException, JMSException   {      JBossMessage m = null;            //If it's receiveNoWait then get the message directly      if (timeout == -1)      {         waiting = false;                  m = (JBossMessage)getMessageNow();                }      else      {         //otherwise we active the server side consumer and          //wait for a message to arrive asynchonrously                  waiting = true;                  activateConsumer();               try         {            if (timeout == 0)            {               //Indefinite wait               m = (JBossMessage)buffer.take();            }                        else            {               //wait with timeout               m = (JBossMessage)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();               }            }         }      }                 if (m != null)      {         JBossMessage jm = (JBossMessage)m;           //if this is the handler for a connection consumer we don't want to set the session delegate         //since this is only used for client acknowledgement which is illegal for a session         //used for an MDB         if (!this.isConnectionConsumer)         {            jm.setSessionDelegate(sessionDelegate);         }      }            return m;   }