MessageReference r = ms.reference((Routable)m);
MessageReference r = ms.reference((org.jboss.messaging.core.Message)m);
   public Object invoke(Invocation invocation) throws Throwable   {      if (invocation instanceof MethodInvocation)      {         MethodInvocation mi = (MethodInvocation)invocation;         Object[] args = mi.getArguments();         if (args != null)         {            for(int i = 0; i < args.length; i++)            {               if (args[i] instanceof Message)               {                  Message m = (Message)args[i];                  Serializable id = m.getJMSMessageID();                  if (log.isTraceEnabled()) log.trace("caching message " + id);                  ServerProducerEndpoint spd = (ServerProducerEndpoint)invocation.getTargetObject();                  MessageStore ms = spd.getServerPeer().getMessageStore();                  MessageReference r = ms.reference((Routable)m);                  // replace the message with its reference                  args[i] = r;               }            }         }      }      return invocation.invokeNext();   }