if (loggingService.isDebugEnabled()) { loggingService.debug("msg="+MessageUtils.toString(message)); Attributes msgattrs = message.cloneAttributes(); if (msgattrs instanceof SimpleMessageAttributes) ((SimpleMessageAttributes)msgattrs).listAttributes(); }
    public MessageAttributes forwardMessage (AttributedMessage message)       throws UnregisteredNameException, NameLookupException,   	         CommFailureException, MisdeliveredMessageException    {      int id = -1;      MessageAttributes attrs = null;      MessageHistory.SendRecord rec;      Exception exception = null;      //  Try sending the message      long sendTime = 0;      try      {        sendTime = now();        attrs = link.forwardMessage (message);      }      catch (Exception e)      {        exception = e;        if (loggingService.isDebugEnabled()) loggingService.debug (stackTraceToString(e));      }      //  NOTE:  Should we include traffic masking messages or heartbeats and the      //  like in the message send history?            //  If we got to this point, we assume the link has successfully      //  sent the message or otherwise thrown an exception.      //  NOTE:  Are we really guaranteed this situation though?  What if the       //  message is stuck in a queue, or some other delayed send situation?      //  NOTE:  The acking message resender now resets the success flag if      //  the message is resent - ie. the message send was sucessful in its      //  first hop, but the lack of an ack back for the message indicates      //  a potential send problem with that transport.            id = AdaptiveLinkSelectionPolicy.getTransportID (link.getProtocolClass());            synchronized (recLock)      {        rec = messageHistory.sends.get (id, message);        if (rec == null) rec = new MessageHistory.SendRecord (id, message);              rec.sendTimestamp = sendTime;        rec.abandonTimestamp = (exception == null ? 0 : now());        rec.success = (exception == null);              messageHistory.sends.put (rec);      }      if (exception != null)      {        if (exception instanceof UnregisteredNameException)        {          throw (UnregisteredNameException) exception;        }        else if (exception instanceof NameLookupException)        {          throw (NameLookupException) exception;        }        else if (exception instanceof CommFailureException)        {          throw (CommFailureException) exception;        }        else if (exception instanceof MisdeliveredMessageException)        {          throw (MisdeliveredMessageException) exception;        }        else        {          throw new CommFailureException (exception);        }      }      return attrs;    }