del.preDeliver(holder.msg.getJMSMessageID(), holder.receiverID);  sessionListener.onMessage(holder.msg);
MessageCallbackHandler.callOnMessage(holder.consumerDelegate, del, sessionListener, holder.receiverID, false, holder.msg);
   public Object invoke(Invocation invocation) throws Throwable   {      if (!(invocation instanceof MethodInvocation))      {         return invocation.invokeNext();      }            MethodInvocation mi = (MethodInvocation)invocation;      String methodName = mi.getMethod().getName();            if ("setMessageListener".equals(methodName))      {           if (log.isTraceEnabled()) { log.trace("setMessageListener"); }         //Invoked from Session         MessageListener listener = (MessageListener)mi.getArguments()[0];         if (listener == null)         {            throw new IllegalStateException("Cannot set a null MessageListener on the session");         }         sessionListener = listener;         return null;      }      else if ("getMessageListener".equals(methodName))      {         if (log.isTraceEnabled()) { log.trace("getMessageListener"); }         //Invoked from Session         return sessionListener;      }      else if ("createConnectionConsumer".equals(methodName))      {                  //Invoked from Connection         if (log.isTraceEnabled()) { log.trace("createConnectionConsumer"); }         Destination dest = (Destination)mi.getArguments()[0];         String subscriptionName = (String)mi.getArguments()[1];         String messageSelector = (String)mi.getArguments()[2];         ServerSessionPool sessionPool = (ServerSessionPool)mi.getArguments()[3];         int maxMessages = ((Integer)mi.getArguments()[4]).intValue();                  ConnectionConsumer cc =            new JBossConnectionConsumer((ConnectionDelegate)getDelegate(mi), dest, subscriptionName,                                        messageSelector, sessionPool, maxMessages);                 return cc;               }      else if ("addAsfMessage".equals(methodName))      {         if (log.isTraceEnabled()) { log.trace("addAsfMessage"); }                  //Invoked from Session                  //Load the session with a message to be processed during a subsequent call to run()                  Message m = (Message)mi.getArguments()[0];         String theReceiverID = (String)mi.getArguments()[1];         if (this.receiverID != null && this.receiverID != theReceiverID)         {            throw new IllegalStateException("Cannot receive messages from more than one receiver");         }         this.receiverID = theReceiverID;                  if (m == null)         {            throw new IllegalStateException("Cannot add a null message to the session");         }         if (receiverID == null)         {            throw new IllegalStateException("Cannot add a message without specifying receiverID");         }                  AsfMessageHolder holder = new AsfMessageHolder();         holder.msg = m;         holder.receiverID = receiverID;                  synchronized (msgs)         {            msgs.add(holder);         }                  return null;      }      else if ("run".equals(methodName))      {                        if (log.isTraceEnabled()) { log.trace("run"); }         SessionDelegate del = (SessionDelegate)getDelegate(mi);         synchronized (msgs)         {            while (msgs.size() > 0)            {               AsfMessageHolder holder = (AsfMessageHolder)msgs.removeFirst();                              del.preDeliver(holder.msg.getJMSMessageID(), holder.receiverID);                              sessionListener.onMessage(holder.msg);                                             del.postDeliver(holder.msg.getJMSMessageID(), holder.receiverID);                           }         }         return null;      }      else if ("getAsfReceiverID".equals(methodName))      {         if (log.isTraceEnabled()) { log.trace("getAsfReceiverID:" + this.receiverID); }         return this.receiverID;      }      return invocation.invokeNext();                  }